about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-04 13:40:05 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-04 13:40:05 +0000
commite7895ac92c8398b1c554e218c373316356ccbd19 (patch)
tree8fe7180ccc077b692f7436c210610d2921e40717 /Src
parent9bbe45297c22d3979c935e412254d4ac376ca4bc (diff)
downloadzsh-e7895ac92c8398b1c554e218c373316356ccbd19.tar.gz
zsh-e7895ac92c8398b1c554e218c373316356ccbd19.tar.xz
zsh-e7895ac92c8398b1c554e218c373316356ccbd19.zip
close dump file descriptors in children (11151)
Diffstat (limited to 'Src')
-rw-r--r--Src/Modules/zpty.c2
-rw-r--r--Src/exec.c1
-rw-r--r--Src/parse.c16
3 files changed, 19 insertions, 0 deletions
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 38da5d500..23b1f4209 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -356,6 +356,8 @@ newptycmd(char *nam, char *pname, char **args, int echo, int block)
 	if (SHTTY != -1)
 	    close(SHTTY);
 
+	closedumps();
+
 	execve(cmd, args, environ);
 	exit(0);
     }
diff --git a/Src/exec.c b/Src/exec.c
index 33f28b53b..7913dec2e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -356,6 +356,7 @@ zexecve(char *pth, char **argv)
     if (!*eep)
 	eep[1] = NULL;
     *eep = buf;
+    closedumps();
     execve(pth, argv, environ);
 
     /* If the execve returns (which in general shouldn't happen),   *
diff --git a/Src/parse.c b/Src/parse.c
index b9ebad9a7..453e45ad0 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -3030,6 +3030,16 @@ decrdumpcount(FuncDump f)
     }
 }
 
+/**/
+mod_export void
+closedumps(void)
+{
+    FuncDump p;
+
+    for (p = dumps; p; p = p->next)
+	zclose(p->fd);
+}
+
 #else
 
 void
@@ -3042,6 +3052,11 @@ decrdumpcount(FuncDump f)
 {
 }
 
+void
+closedumps(void)
+{
+}
+
 #endif
 
 /**/
@@ -3070,3 +3085,4 @@ dump_autoload(char *nam, char *file, int on, char *ops, int func)
     }
     return ret;
 }
+