aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runit/runsvdir.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/runit/runsvdir.c b/runit/runsvdir.c
index b4450c00c..df6b8869d 100644
--- a/runit/runsvdir.c
+++ b/runit/runsvdir.c
@@ -141,8 +141,12 @@ static void runsvdir(void)
}
for (i = 0; i < svnum; i++)
sv[i].isgone = 1;
- errno = 0;
- while ((d = readdir(dir))) {
+
+ while (1) {
+ errno = 0;
+ d = readdir(dir);
+ if (!d)
+ break;
if (d->d_name[0] == '.')
continue;
if (stat(d->d_name, &s) == -1) {
@@ -194,6 +198,7 @@ static void runsvdir(void)
if (sv[i].pid)
kill(sv[i].pid, SIGTERM);
sv[i] = sv[--svnum];
+/* BUG? we deleted sv[i] by copying over sv[last], but we will not check this newly-copied one! */
check = 1;
}
}