summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/signals.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f4eac9192..5390fef13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-08-10  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 36074: Src/signals.c: Don't rely on implicit value for
+	saving status of background process.
+
 2015-08-10  Frank Terbeck  <ft@bewatermyfriend.org>
 
 	* 36046: Completion/Unix/Command/_tmux: _tmux: Update command line
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);
+	}
     }
 }