diff options
| author | Peter Stephenson <pws@zsh.org> | 2015-01-20 09:29:22 +0000 |
|---|---|---|
| committer | Peter Stephenson <pws@zsh.org> | 2015-01-20 09:29:22 +0000 |
| commit | e6d964246700581fe22ea834b2ea12dd301e8c3d (patch) | |
| tree | 7961ea0a86e1690136e53f0949feb60624d9c058 /Src/exec.c | |
| parent | 34322: bug with interface to parsestr() etc. (diff) | |
| download | zsh-e6d964246700581fe22ea834b2ea12dd301e8c3d.tar zsh-e6d964246700581fe22ea834b2ea12dd301e8c3d.tar.gz zsh-e6d964246700581fe22ea834b2ea12dd301e8c3d.tar.bz2 zsh-e6d964246700581fe22ea834b2ea12dd301e8c3d.tar.lz zsh-e6d964246700581fe22ea834b2ea12dd301e8c3d.tar.xz zsh-e6d964246700581fe22ea834b2ea12dd301e8c3d.tar.zst zsh-e6d964246700581fe22ea834b2ea12dd301e8c3d.zip | |
users/19751: remove error on failure to close file descriptor by number.
Keep it when closing file descriptor stored in a variable, i.e.
explicitly opened by the user.
Diffstat (limited to 'Src/exec.c')
| -rw-r--r-- | Src/exec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c index f42fb2b9b..3b0e936b4 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3203,7 +3203,12 @@ execcmd(Estate state, int input, int output, int how, int last1) } if (fn->fd1 < 10) closemn(mfds, fn->fd1, REDIR_CLOSE); - if (!closed && zclose(fn->fd1) < 0) { + /* + * Only report failures to close file descriptors + * if they're under user control as we don't know + * what the previous status of others was. + */ + if (!closed && zclose(fn->fd1) < 0 && fn->varid) { zwarn("failed to close file descriptor %d: %e", fn->fd1, errno); } |
