summary refs log tree commit diff
path: root/src/funcs
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2019-01-18 13:01:18 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2019-02-25 12:52:12 +0800
commit48875c1201930d1e71d358eb1cf3eacc166795be (patch)
tree999c367b70ef908863c937944a206fb8b3cdcf7b /src/funcs
parentoutput: Fix clang warnings about GNU old-style field designator (diff)
downloaddash-48875c1201930d1e71d358eb1cf3eacc166795be.tar.gz
dash-48875c1201930d1e71d358eb1cf3eacc166795be.zip
redir: Handle nested exec within REALLY_CLOSED redirection
The value of REALLY_CLOSED is used to avoid an unnecessary close(2)
call when restoring redirections.  However, as it stands it can
remove a close(2) call that's actually needed.  This happens when
an enclosed exec(1) command leaves an open file descriptor behind.

This patch fixes this by replacing REALLY_CLOSED with closed_redirs
to track the current status of redirected file descriptors and
leaving redirlist to only handle the previous state of redirected
file descriptors.

Reported-by: Martijn Dekker <martijn@inlv.org>
Fixes: ce0f1900d869 ("[REDIR] Fix redirect restore on saved file...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/funcs')
0 files changed, 0 insertions, 0 deletions