← Commit list

a98b95b71

Denys Vlasenko
Denys Vlasenko
2025-07-30
SUCCESS Duration: 154s

Subject

*: use safe_waitpid() or wait_any_nohang() where approppriate

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 →

e2fsprogs/fsck.c+1 -3
@@ -423,13 +423,11 @@ static int wait_one(int flags)
/* if (G.noexecute) { already returned -1; } */
while (1) {
- pid = waitpid(-1, &status, flags);
+ pid = safe_waitpid(-1, &status, flags);
kill_all_if_got_signal();
if (pid == 0) /* flags == WNOHANG and no children exited */
return -1;
if (pid < 0) {
- if (errno == EINTR)
- continue;
if (errno == ECHILD) { /* paranoia */
bb_simple_error_msg("wait: no more children");
return -1;
init/init.c+1 -1
@@ -1201,7 +1201,7 @@ int init_main(int argc UNUSED_PARAM, char **argv)
int status;
struct init_action *a;
- wpid = waitpid(-1, &status, WNOHANG);
+ wpid = wait_any_nohang(&status);
if (wpid <= 0)
break;
miscutils/crond.c+7 -3
@@ -989,7 +989,7 @@ static int check_completions(void)
if (line->cl_pid <= 0)
continue;
- r = waitpid(line->cl_pid, NULL, WNOHANG);
+ r = safe_waitpid(line->cl_pid, NULL, WNOHANG);
if (r < 0 || r == line->cl_pid) {
process_finished_job(file->cf_username, line);
if (line->cl_pid == 0) {
@@ -1002,8 +1002,12 @@ static int check_completions(void)
file->cf_has_running = 1;
}
- /* Reap any other children we don't actively track */
- while (waitpid(-1, NULL, WNOHANG) > 0);
+ /* Reap any other children we don't actively track.
+ * Reportedly, some people run crond as init process!
+ * Thus, we need to reap orphans, like init does.
+ */
+ while (wait_any_nohang(NULL) > 0)
+ continue;
//FIXME: if !file->cf_has_running && file->deleted: delete it!
//otherwise deleted entries will stay forever, right?