summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2005-12-14 17:26:29 +0000
committermaxim <maxim@FreeBSD.org>2005-12-14 17:26:29 +0000
commitb2df6a6cc0b4b788a14fd296e74fbaefe54d6370 (patch)
tree0bf65832ceefa8587caa163a344c576ccb5c978d /bin
parent024393974926883a14f0ecb8a32bb767f287258f (diff)
downloadFreeBSD-src-b2df6a6cc0b4b788a14fd296e74fbaefe54d6370.zip
FreeBSD-src-b2df6a6cc0b4b788a14fd296e74fbaefe54d6370.tar.gz
o Now when SIG_IGN signal action for SIGCHLD reap zombies
automatically it is possible wait4(2) returns -1 and sets errno = ECHILD if there were forked children. A user can set such signal handler e.g. via ``trap "" 20'', see a PR for the test case. Deal with this case and mark a job as JOBDONE. PR: bin/90334 Submitted by: bde MFC after: 4 weeks
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/jobs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index ac03c95..71e80f4 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -924,6 +924,8 @@ dowait(int block, struct job *job)
} while ((pid == -1 && errno == EINTR && breakwaitcmd == 0) ||
(pid > 0 && WIFSTOPPED(status) && !iflag));
in_dowait--;
+ if (pid == -1 && errno == ECHILD && job != NULL)
+ job->state = JOBDONE;
if (breakwaitcmd != 0) {
breakwaitcmd = 0;
if (pid <= 0)
OpenPOWER on IntegriCloud