diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2011-07-19 09:26:56 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2011-07-19 09:26:56 +0000 |
commit | a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b (patch) | |
tree | 493f7cee0ec7eaf97e5bc1b10e71cb4a8b3d30fd | |
parent | 5c3c825e5fee76829b8f61020c3f0e72f9f6b316 (diff) | |
download | zsh-a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b.tar.gz zsh-a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b.tar.xz zsh-a8657c4b40c74416b1e2cd0ed85d114d0d99cd4b.zip |
29555: fix problem using open fd beyond max_zsh_fd
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | Src/exec.c | 16 |
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 { |