summary refs log tree commit diff
path: root/src/trap.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2010-05-27 21:37:14 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2010-05-27 21:37:14 +1000
commit207e4c2a322fe0f928944f7004b5b17ae2dceaaa (patch)
tree51b52f1f6065ac676e74931ee7eeae222c6d9d02 /src/trap.c
parent[EXPAND] Fix corruption of redirections with byte 0x81 (diff)
downloaddash-207e4c2a322fe0f928944f7004b5b17ae2dceaaa.tar.gz
dash-207e4c2a322fe0f928944f7004b5b17ae2dceaaa.zip
[JOBS] Fix wait regression where it does not wait for all jobs
The sigsuspend patch broke wait by making it return after just
one job has completed.  This is because we rely on pendingsigs
to signal work and never clear it until waitcmd finishes.

This patch adds a separate gotsigchld for this purpose so we
can clear it before we start waiting.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r--src/trap.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/trap.c b/src/trap.c
index ba32da6..7bd60ab 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -78,6 +78,8 @@ char sigmode[NSIG - 1];
 static char gotsig[NSIG - 1];
 /* last pending signal */
 volatile sig_atomic_t pendingsigs;
+/* received SIGCHLD */
+int gotsigchld;
 
 extern char *signal_names[];
 
@@ -284,6 +286,12 @@ ignoresig(int signo)
 void
 onsig(int signo)
 {
+	if (signo == SIGCHLD) {
+		gotsigchld = 1;
+		if (!trap[SIGCHLD])
+			return;
+	}
+
 	gotsig[signo - 1] = 1;
 	pendingsigs = signo;