From 19d099fc86dabc1087cf78ed99035a3da79bd709 Mon Sep 17 00:00:00 2001 From: Maxim Konovalov Date: Wed, 14 Dec 2005 17:26:29 +0000 Subject: [PATCH] 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 --- bin/sh/jobs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index ac03c95bec4..71e80f41955 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)