← Commit list

daeddee44

Denis Vlasenko
Denis Vlasenko
2008-04-19
FAILED Duration: 18s

Subject

start_stop_daemon: do not stop /proc scan prematurely

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

debianutils/start_stop_daemon.c+12 -5
@@ -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)