summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--Src/exec.c16
2 files changed, 17 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ccf74e02d..4050d1dce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-19 Peter Stephenson <pws@csr.com>
+
+ * 29555: Src/exec.c: fix problem that shell failed to use file
+ descriptor opened in parent if beyond max_zsh_fd.
+
2011-07-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
* users/16131: Src/hist.c: skip reading an empty history file.
@@ -15115,5 +15120,5 @@
*****************************************************
* This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5397 $
+* $Revision: 1.5398 $
*****************************************************
diff --git a/Src/exec.c b/Src/exec.c
index 644a58367..f5b59a36e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3008,11 +3008,17 @@ execcmd(Estate state, int input, int output, int how, int last1)
if (!checkclobberparam(fn))
fil = -1;
else if (fn->fd2 > 9 &&
- (fn->fd2 > max_zsh_fd ||
- (fdtable[fn->fd2] != FDT_UNUSED &&
- fdtable[fn->fd2] != FDT_EXTERNAL) ||
- fn->fd2 == coprocin ||
- fn->fd2 == coprocout)) {
+ /*
+ * If the requested fd is > max_zsh_fd,
+ * the shell doesn't know about it.
+ * Just assume the user knows what they're
+ * doing.
+ */
+ (fn->fd2 <= max_zsh_fd &&
+ ((fdtable[fn->fd2] != FDT_UNUSED &&
+ fdtable[fn->fd2] != FDT_EXTERNAL) ||
+ fn->fd2 == coprocin ||
+ fn->fd2 == coprocout))) {
fil = -1;
errno = EBADF;
} else {