about summary refs log tree commit diff
path: root/Src/Modules
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-04-24 10:57:03 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-04-24 11:48:11 +0100
commit95d861d0283e47c64980c844d66be44c6c4aad8a (patch)
treea659a534c4876d51667e94e12b509145f0a7c3cf /Src/Modules
parent9ad9c5cda1087151c64074a965a68b407a8bd229 (diff)
downloadzsh-95d861d0283e47c64980c844d66be44c6c4aad8a.tar.gz
zsh-95d861d0283e47c64980c844d66be44c6c4aad8a.tar.xz
zsh-95d861d0283e47c64980c844d66be44c6c4aad8a.zip
42708: fix for process substitution.
Don't close associated file descriptors in the closem()
tidy up function as they should remain visible to external
processes.  Override if about to exit.

Unit test for the failing case: note this relies on the
existence of /proc/self/fd or equivalent.
Diffstat (limited to 'Src/Modules')
-rw-r--r--Src/Modules/clone.c2
-rw-r--r--Src/Modules/zpty.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Src/Modules/clone.c b/Src/Modules/clone.c
index 930429248..ef6275dcf 100644
--- a/Src/Modules/clone.c
+++ b/Src/Modules/clone.c
@@ -69,7 +69,7 @@ bin_clone(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
 	dup2(ttyfd,2);
 	if (ttyfd > 2)
 	    close(ttyfd);
-	closem(0);
+	closem(FDT_UNUSED, 0);
 	close(coprocin);
 	close(coprocout);
 	/* Acquire a controlling terminal */
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 1c93a1d02..2f83f7ce6 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -400,7 +400,7 @@ newptycmd(char *nam, char *pname, char **args, int echo, int nblock)
 	dup2(slave, 1);
 	dup2(slave, 2);
 
-	closem(0);
+	closem(FDT_UNUSED, 0);
 	close(slave);
 	close(master);
 	close(coprocin);