diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2018-03-27 00:39:35 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-04-19 18:19:29 +0800 |
commit | 46d5a7fcea81b489819f753451c1ad2fe435f148 (patch) | |
tree | 815be18bb4833adef40246c99a4be0a9cd762fd4 /src/eval.c | |
parent | eval: Reap zombies after built-in commands and functions (diff) | |
download | dash-46d5a7fcea81b489819f753451c1ad2fe435f148.tar.gz dash-46d5a7fcea81b489819f753451c1ad2fe435f148.zip |
eval: Restore input files in evalcommand
When evalcommand invokes a command that modifies parsefile and then bails out without popping the file, we need to ensure the input file is restored so that the shell can continue to execute. Reported-by: Martijn Dekker <martijn@inlv.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to '')
-rw-r--r-- | src/eval.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c index 19e06ec..4b67fc9 100644 --- a/src/eval.c +++ b/src/eval.c @@ -694,6 +694,7 @@ evalcommand(union node *cmd, int flags) #endif { struct localvar_list *localvar_stop; + struct parsefile *file_stop; struct redirtab *redir_stop; struct stackmark smark; union node *argp; @@ -722,6 +723,7 @@ evalcommand(union node *cmd, int flags) TRACE(("evalcommand(0x%lx, %d) called\n", (long)cmd, flags)); setstackmark(&smark); localvar_stop = pushlocalvars(); + file_stop = parsefile; back_exitstatus = 0; cmdentry.cmdtype = CMDBUILTIN; @@ -896,6 +898,7 @@ out: if (cmd->ncmd.redirect) popredir(execcmd); unwindredir(redir_stop); + unwindfiles(file_stop); unwindlocalvars(localvar_stop); if (lastarg) /* dsl: I think this is intended to be used to support |