[git commit master 1/1] runsvdir: do not miss closely spaced service dir changes

Denys Vlasenko vda.linux at googlemail.com
Mon Dec 6 00:26:26 UTC 2010


commit: http://git.busybox.net/busybox/commit/?id=31905f94777ae6e7181e9fbcc0cc7c4cf70abfaf
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Eric Lammerts <busybox at lists.lammerts.org>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 runit/runsvdir.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/runit/runsvdir.c b/runit/runsvdir.c
index e77eeff..1666642 100644
--- a/runit/runsvdir.c
+++ b/runit/runsvdir.c
@@ -312,8 +312,11 @@ int runsvdir_main(int argc UNUSED_PARAM, char **argv)
 						last_mtime = s.st_mtime;
 						last_dev = s.st_dev;
 						last_ino = s.st_ino;
-						//if (now <= mtime)
-						//	sleep(1);
+						/* if the svdir changed this very second, wait until the
+						 * next second, because we won't be able to detect more
+						 * changes within this second */
+						while (time(NULL) == last_mtime)
+							usleep(100000);
 						need_rescan = do_rescan();
 						while (fchdir(curdir) == -1) {
 							warn2_cannot("change directory, pausing", "");
-- 
1.7.2.2



More information about the busybox-cvs mailing list