summary refs log tree commit diff
path: root/Src/signals.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-08-10 16:59:55 +0100
committerPeter Stephenson <pws@zsh.org>2015-08-10 16:59:55 +0100
commita07f74fadd1180b42258d1fcec5359afe3f9ba00 (patch)
tree6a30a848d1f8c740135569b68fd906a7d98d8103 /Src/signals.c
parentc6136b94f361ec33fbb231c97ea37a2248080de3 (diff)
downloadzsh-a07f74fadd1180b42258d1fcec5359afe3f9ba00.tar.gz
zsh-a07f74fadd1180b42258d1fcec5359afe3f9ba00.tar.xz
zsh-a07f74fadd1180b42258d1fcec5359afe3f9ba00.zip
Don't rely on implicit value when saving background process status
Diffstat (limited to 'Src/signals.c')
-rw-r--r--Src/signals.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/Src/signals.c b/Src/signals.c
index 697c4c5ec..78dc75b1b 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -528,8 +528,14 @@ wait_for_processes(void)
 	 * and is not equal to the current foreground job.
 	 */
 	if (jn && !(jn->stat & (STAT_CURSH|STAT_BUILTIN)) &&
-	    jn - jobtab != thisjob)
-	    addbgstatus(pid, (int)lastval2);
+	    jn - jobtab != thisjob) {
+	    int val = (WIFSIGNALED(status) ?
+		   0200 | WTERMSIG(status) :
+		   (WIFSTOPPED(status) ?
+		    0200 | WEXITSTATUS(status) :
+		    WEXITSTATUS(status)));
+	    addbgstatus(pid, val);
+	}
     }
 }