summaryrefslogtreecommitdiff
path: root/debianutils
diff options
context:
space:
mode:
authorDenis Vlasenko2008-04-19 20:19:45 +0000
committerDenis Vlasenko2008-04-19 20:19:45 +0000
commitdaeddee442e1cd7be15da6be472a637b8547fde7 (patch)
tree68e119fc56ff548e68830747f08989cf2077c8da /debianutils
parentf3745ea489c5ef454e2ce68926c5f39f5b30f240 (diff)
downloadbusybox-daeddee442e1cd7be15da6be472a637b8547fde7.zip
busybox-daeddee442e1cd7be15da6be472a637b8547fde7.tar.gz
start_stop_daemon: do not stop /proc scan prematurely
function old new delta do_procinit 185 196 +11
Diffstat (limited to 'debianutils')
-rw-r--r--debianutils/start_stop_daemon.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 2f8e04a..b6b30e7 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -145,11 +145,18 @@ static void do_procinit(void)
procdir = xopendir("/proc");
pid = 0;
- while ((entry = readdir(procdir)) != NULL) {
- pid = bb_strtou(entry->d_name, NULL, 10);
- if (errno)
- continue;
- check(pid);
+ while(1) {
+ errno = 0; /* clear any previous error */
+ entry = readdir(procdir);
+// TODO: check for exact errno(s) which mean that we got stale entry
+ if (errno) /* Stale entry, process has died after opendir */
+ continue;
+ if (!entry) /* EOF, no more entries */
+ break;
+ pid = bb_strtou(entry->d_name, NULL, 10);
+ if (errno) /* NaN */
+ continue;
+ check(pid);
}
closedir(procdir);
if (!pid)