about summary refs log tree commit diff
path: root/Src/signals.c
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 /Src/signals.c
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.
Diffstat (limited to 'Src/signals.c')
-rw-r--r--Src/signals.c3
1 files changed, 2 insertions, 1 deletions
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)) {
 			/*