diff options
| author | Ron Yorston <rmy@pobox.com> | 2025-08-15 09:00:13 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2025-08-15 09:00:13 +0100 |
| commit | 01ff9c492111cf7d51ad074629d6e72bc69fc149 (patch) | |
| tree | 394973e4e5f25dcd638185be75b84430c39ebab2 /miscutils | |
| parent | 9a2d9345377d38c428df6d3e0887956d359807ab (diff) | |
| parent | 8bde71eb1502a5cdf186769b47d470038f99bc95 (diff) | |
| download | busybox-w32-01ff9c492111cf7d51ad074629d6e72bc69fc149.tar.gz busybox-w32-01ff9c492111cf7d51ad074629d6e72bc69fc149.tar.bz2 busybox-w32-01ff9c492111cf7d51ad074629d6e72bc69fc149.zip | |
Merge branch 'busybox' into merge
Diffstat (limited to 'miscutils')
| -rw-r--r-- | miscutils/crond.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c index 96131cae4..6a384fdfb 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
| @@ -989,7 +989,7 @@ static int check_completions(void) | |||
| 989 | if (line->cl_pid <= 0) | 989 | if (line->cl_pid <= 0) |
| 990 | continue; | 990 | continue; |
| 991 | 991 | ||
| 992 | r = waitpid(line->cl_pid, NULL, WNOHANG); | 992 | r = safe_waitpid(line->cl_pid, NULL, WNOHANG); |
| 993 | if (r < 0 || r == line->cl_pid) { | 993 | if (r < 0 || r == line->cl_pid) { |
| 994 | process_finished_job(file->cf_username, line); | 994 | process_finished_job(file->cf_username, line); |
| 995 | if (line->cl_pid == 0) { | 995 | if (line->cl_pid == 0) { |
| @@ -1001,6 +1001,14 @@ static int check_completions(void) | |||
| 1001 | /* else: r == 0: "process is still running" */ | 1001 | /* else: r == 0: "process is still running" */ |
| 1002 | file->cf_has_running = 1; | 1002 | file->cf_has_running = 1; |
| 1003 | } | 1003 | } |
| 1004 | |||
| 1005 | /* Reap any other children we don't actively track. | ||
| 1006 | * Reportedly, some people run crond as init process! | ||
| 1007 | * Thus, we need to reap orphans, like init does. | ||
| 1008 | */ | ||
| 1009 | while (wait_any_nohang(NULL) > 0) | ||
| 1010 | continue; | ||
| 1011 | |||
| 1004 | //FIXME: if !file->cf_has_running && file->deleted: delete it! | 1012 | //FIXME: if !file->cf_has_running && file->deleted: delete it! |
| 1005 | //otherwise deleted entries will stay forever, right? | 1013 | //otherwise deleted entries will stay forever, right? |
| 1006 | num_still_running += file->cf_has_running; | 1014 | num_still_running += file->cf_has_running; |
