about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-03-25 18:17:07 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-03-25 18:17:07 +0000
commit845faf558661d5c264a335d9e0b474285ffc8962 (patch)
treeecc97346799e954225e7c5b087cbf617e4f02683
parent56e1904e45cc474a9858dc1205055008f8c63752 (diff)
downloadzsh-845faf558661d5c264a335d9e0b474285ffc8962.tar.gz
zsh-845faf558661d5c264a335d9e0b474285ffc8962.tar.xz
zsh-845faf558661d5c264a335d9e0b474285ffc8962.zip
22281: wait shouldn't return immediately on signal unless trapped
-rw-r--r--ChangeLog3
-rw-r--r--Src/jobs.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f2e0d04e..428122b72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-03-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 24733: Src/jobs.c: wait shouldn't return immediately on
+	a signal unless it's trapped (bug in 22281).
+
 	* 24732: Src/Builtins/sched.c: not enough space for ztrftime
 	string with multibyte characters.
 
diff --git a/Src/jobs.c b/Src/jobs.c
index 9bdc602de..1b3d37c63 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1170,7 +1170,8 @@ waitforpid(pid_t pid, int wait_cmd)
 
 	last_signal = -1;
 	signal_suspend(SIGCHLD);
-	if (last_signal != SIGCHLD && wait_cmd) {
+	if (last_signal != SIGCHLD && wait_cmd && last_signal >= 0 &&
+	    (sigtrapped[last_signal] & ZSIG_TRAPPED)) {
 	    /* wait command interrupted, but no error: return */
 	    restore_queue_signals(q);
 	    return 128 + last_signal;
@@ -1208,7 +1209,8 @@ zwaitjob(int job, int wait_cmd)
 	       !(jn->stat & STAT_DONE) &&
 	       !(interact && (jn->stat & STAT_STOPPED))) {
 	    signal_suspend(SIGCHLD);
-	    if (last_signal != SIGCHLD && wait_cmd)
+	    if (last_signal != SIGCHLD && wait_cmd && last_signal >= 0 &&
+		(sigtrapped[last_signal] & ZSIG_TRAPPED))
 	    {
 		/* builtin wait interrupted by trapped signal */
 		restore_queue_signals(q);