summary refs log tree commit diff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-07-23 09:34:11 +0100
committerPeter Stephenson <pws@zsh.org>2015-07-23 09:34:11 +0100
commit28a962f557952a6001d37f4f4f7034361d11bf89 (patch)
tree619000f12f12992f4521e99c05d170b235e6bfb2 /Src/exec.c
parent49ff2e00dc3787b3575f392f53d90774f1dbbdce (diff)
downloadzsh-28a962f557952a6001d37f4f4f7034361d11bf89.tar.gz
zsh-28a962f557952a6001d37f4f4f7034361d11bf89.tar.xz
zsh-28a962f557952a6001d37f4f4f7034361d11bf89.zip
35849: close fd's from process substitution after fork
Leaving these hanging in parent could cause deadlock: test added.
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 4eee82bf1..7612d4303 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3047,6 +3047,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 	    addproc(pid, text, 0, &bgtime);
 	    if (oautocont >= 0)
 		opts[AUTOCONTINUE] = oautocont;
+	    pipecleanfilelist(jobtab[thisjob].filelist, 1);
 	    return;
 	}
 	/* pid == 0 */
@@ -3492,7 +3493,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 
 	    if (is_shfunc) {
 		/* It's a shell function */
-		pipecleanfilelist(filelist);
+		pipecleanfilelist(filelist, 0);
 		execshfunc((Shfunc) hn, args);
 	    } else {
 		/* It's a builtin */
@@ -3682,7 +3683,7 @@ execcmd(Estate state, int input, int output, int how, int last1)
 		DPUTS(varspc,
 		      "BUG: assignment before complex command");
 		list_pipe = 0;
-		pipecleanfilelist(filelist);
+		pipecleanfilelist(filelist, 0);
 		/* If we're forked (and we should be), no need to return */
 		DPUTS(last1 != 1 && !forked, "BUG: not exiting?");
 		DPUTS(type != WC_SUBSH, "Not sure what we're doing.");