about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c3
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c43272ecf..967c63170 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-09-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 39435: Src/exec.c: Don't set gleader of SUBJOB immediately if
+	SUPERJOB has no processes.
+
 2016-09-24  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 39423: Completion/Zsh/Command/_zed: Support the '--'
diff --git a/Src/exec.c b/Src/exec.c
index d924148d6..a5086c33c 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1703,7 +1703,8 @@ execpline(Estate state, wordcode slcode, int how, int last1)
 			    jobtab[list_pipe_job].stat |= STAT_SUPERJOB;
 			    jn->stat |= STAT_SUBJOB | STAT_NOPRINT;
 			    jn->other = pid;
-			    jn->gleader = jobtab[list_pipe_job].gleader;
+			    if (hasprocs(list_pipe_job))
+				jn->gleader = jobtab[list_pipe_job].gleader;
 			}
 			if ((list_pipe || last1) && hasprocs(list_pipe_job))
 			    killpg(jobtab[list_pipe_job].gleader, SIGSTOP);