about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-04-23 15:11:34 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-04-23 15:11:34 +0100
commit9ad9c5cda1087151c64074a965a68b407a8bd229 (patch)
tree99d06ac7d73c749ef3a33d37ed760690daf25bb2
parent11f18457d229b84c3532c15c9080235e85d26866 (diff)
downloadzsh-9ad9c5cda1087151c64074a965a68b407a8bd229.tar.gz
zsh-9ad9c5cda1087151c64074a965a68b407a8bd229.tar.xz
zsh-9ad9c5cda1087151c64074a965a68b407a8bd229.zip
42705: Another safety fix for pgrp reclaiming.
Only do this if killpg(dead_pid, 0) returns -1, indicating
the pgprp doesn't exist any more, else there is a race
if other proceses have started using it.
-rw-r--r--ChangeLog3
-rw-r--r--Src/signals.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5bcdf2d4e..632a35717 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-04-23  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* 42705: Src/signals.c: another fix for 42630 --- also check
+	that killpg(pgrp, 0) is -1.
+
 	* 23362: Src/parse.c: Allow short loops with "while".
 
 2018-04-20  Peter Stephenson  <p.stephenson@samsung.com>
diff --git a/Src/signals.c b/Src/signals.c
index 6e1215875..f2165c005 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -538,7 +538,8 @@ wait_for_processes(void)
 		update_process(pn, status);
 #endif
 		if (WIFEXITED(status) &&
-		    pn->pid == jn->gleader) {
+		    pn->pid == jn->gleader &&
+		    killpg(pn->pid, 0) == -1) {
 		    jn->gleader = 0;
 		    if (!(jn->stat & STAT_NOSTTY)) {
 			/*