about summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2013-12-20 23:03:46 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2013-12-20 23:03:46 -0800
commit9887fc3d7b4508bb21e419a8ce12be9c1ba37e4b (patch)
treeb47d012e680935591b12f55bc05df0d001340b41 /Src/exec.c
parent58614f16693a741396840fbb3db0f9ba1e53cfcb (diff)
downloadzsh-9887fc3d7b4508bb21e419a8ce12be9c1ba37e4b.tar.gz
zsh-9887fc3d7b4508bb21e419a8ce12be9c1ba37e4b.tar.xz
zsh-9887fc3d7b4508bb21e419a8ce12be9c1ba37e4b.zip
32171: close pipe descriptor in parent when left side is a shell construct to
prevent deadlock

Also clean up ChangeLog entry that attributed 32119 to 32114
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Src/exec.c b/Src/exec.c
index dccdc2b0d..44800339f 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1691,6 +1691,7 @@ execpline2(Estate state, wordcode pcode,
 	execcmd(state, input, output, how, last1 ? 1 : 2);
     else {
 	int old_list_pipe = list_pipe;
+	int subsh_close = -1;
 	Wordcode next = state->pc + (*state->pc), pc;
 	wordcode code;
 
@@ -1738,6 +1739,7 @@ execpline2(Estate state, wordcode pcode,
 	} else {
 	    /* otherwise just do the pipeline normally. */
 	    addfilelist(NULL, pipes[0]);
+	    subsh_close = pipes[0];
 	    execcmd(state, input, pipes[1], how, 0);
 	}
 	zclose(pipes[1]);
@@ -1750,6 +1752,8 @@ execpline2(Estate state, wordcode pcode,
 	execpline2(state, *state->pc++, how, pipes[0], output, last1);
 	list_pipe = old_list_pipe;
 	cmdpop();
+	if (subsh_close != pipes[0])
+	    zclose(pipes[0]);
     }
 }