about summary refs log tree commit diff
path: root/Src/utils.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2005-03-31 09:54:54 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2005-03-31 09:54:54 +0000
commit38eb8ac2939949c99b30c13a819ef71851762422 (patch)
treebe3703e8afd1f5adf5eac44ddd0df0b301adcf36 /Src/utils.c
parent60a22c7a25d2a77579b0b2342c439b994692c99c (diff)
downloadzsh-38eb8ac2939949c99b30c13a819ef71851762422.tar.gz
zsh-38eb8ac2939949c99b30c13a819ef71851762422.tar.xz
zsh-38eb8ac2939949c99b30c13a819ef71851762422.zip
21049: Don't close process substitution file descriptors for external programmes
Diffstat (limited to 'Src/utils.c')
-rw-r--r--Src/utils.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Src/utils.c b/Src/utils.c
index 936433a09..eb6edf719 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1078,10 +1078,11 @@ movefd(int fd)
     if(fd != -1) {
 	if (fd > max_zsh_fd) {
 	    while (fd >= fdtable_size)
-		fdtable = zrealloc(fdtable, (fdtable_size *= 2));
+		fdtable = zrealloc(fdtable,
+				   (fdtable_size *= 2)*sizeof(*fdtable));
 	    max_zsh_fd = fd;
 	}
-	fdtable[fd] = 1;
+	fdtable[fd] = FDT_INTERNAL;
     }
     return fd;
 }
@@ -1096,7 +1097,7 @@ redup(int x, int y)
 	zclose(y);
     else if (x != y) {
 	while (y >= fdtable_size)
-	    fdtable = zrealloc(fdtable, (fdtable_size *= 2));
+	    fdtable = zrealloc(fdtable, (fdtable_size *= 2)*sizeof(*fdtable));
 	dup2(x, y);
 	if ((fdtable[y] = fdtable[x]) && y > max_zsh_fd)
 	    max_zsh_fd = y;
@@ -1111,8 +1112,8 @@ mod_export int
 zclose(int fd)
 {
     if (fd >= 0) {
-	fdtable[fd] = 0;
-	while (max_zsh_fd > 0 && !fdtable[max_zsh_fd])
+	fdtable[fd] = FDT_UNUSED;
+	while (max_zsh_fd > 0 && fdtable[max_zsh_fd] == FDT_UNUSED)
 	    max_zsh_fd--;
 	if (fd == coprocin)
 	    coprocin = -1;