diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-19 20:19:45 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-04-19 20:19:45 +0000 |
commit | daeddee442e1cd7be15da6be472a637b8547fde7 (patch) | |
tree | 68e119fc56ff548e68830747f08989cf2077c8da /debianutils/start_stop_daemon.c | |
parent | f3745ea489c5ef454e2ce68926c5f39f5b30f240 (diff) | |
download | busybox-w32-daeddee442e1cd7be15da6be472a637b8547fde7.tar.gz busybox-w32-daeddee442e1cd7be15da6be472a637b8547fde7.tar.bz2 busybox-w32-daeddee442e1cd7be15da6be472a637b8547fde7.zip |
start_stop_daemon: do not stop /proc scan prematurely
function old new delta
do_procinit 185 196 +11
Diffstat (limited to 'debianutils/start_stop_daemon.c')
-rw-r--r-- | debianutils/start_stop_daemon.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c index 2f8e04a78..b6b30e7cc 100644 --- a/debianutils/start_stop_daemon.c +++ b/debianutils/start_stop_daemon.c | |||
@@ -145,11 +145,18 @@ static void do_procinit(void) | |||
145 | procdir = xopendir("/proc"); | 145 | procdir = xopendir("/proc"); |
146 | 146 | ||
147 | pid = 0; | 147 | pid = 0; |
148 | while ((entry = readdir(procdir)) != NULL) { | 148 | while(1) { |
149 | pid = bb_strtou(entry->d_name, NULL, 10); | 149 | errno = 0; /* clear any previous error */ |
150 | if (errno) | 150 | entry = readdir(procdir); |
151 | continue; | 151 | // TODO: check for exact errno(s) which mean that we got stale entry |
152 | check(pid); | 152 | if (errno) /* Stale entry, process has died after opendir */ |
153 | continue; | ||
154 | if (!entry) /* EOF, no more entries */ | ||
155 | break; | ||
156 | pid = bb_strtou(entry->d_name, NULL, 10); | ||
157 | if (errno) /* NaN */ | ||
158 | continue; | ||
159 | check(pid); | ||
153 | } | 160 | } |
154 | closedir(procdir); | 161 | closedir(procdir); |
155 | if (!pid) | 162 | if (!pid) |