diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2020-01-19 18:21:59 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2020-04-29 16:04:17 +1000 |
commit | f613f9573f044220453069ee81ed8706c6e18225 (patch) | |
tree | 89c0248f36c673e01909222f9f79718d054eee9b /src/init.h | |
parent | shell: delete AC_PROG_YACC (diff) | |
download | dash-f613f9573f044220453069ee81ed8706c6e18225.tar.gz dash-f613f9573f044220453069ee81ed8706c6e18225.zip |
redir: Clear saved redirections in subshell
When we enter a subshell we need to drop the saved redirections as otherwise a subsequent unwindredir could produce incorrect results. This patch does this by simply clearing redirlist. While we could actually free the memory underneath for subshells it isn't really worth the trouble for now. In order to ensure that this is done in every place where we enter a subshell, this patch adds a new mkinit hook called forkreset. The calls closescript, clear_traps and reset_handler are also added to the forkreset hook. This fixes a bug where the first two functions weren't called if we enter a subshell without forking. Reported-by: Harald van Dijk <harald@gigawatt.nl> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | src/init.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/init.h b/src/init.h index 49791a0..d56fb28 100644 --- a/src/init.h +++ b/src/init.h @@ -36,4 +36,5 @@ void init(void); void exitreset(void); +void forkreset(void); void reset(void); |