diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2018-12-14 13:52:02 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-02-25 12:52:11 +0800 |
commit | 62cf6955f8abe875752d7163f6f3adbc7e49ebae (patch) | |
tree | 9e00ec01755501a903f7623b1f1ffd09646298dc /src/main.c | |
parent | eval: avoid leaking memory associated with redirections (diff) | |
download | dash-62cf6955f8abe875752d7163f6f3adbc7e49ebae.tar.gz dash-62cf6955f8abe875752d7163f6f3adbc7e49ebae.zip |
eval: Only restore exit status on exit/return
We unconditionally restore the saved status in exitreset, which is incorrect as we only want to do it for exitcmd and returncmd. This patch fixes the problem by introducing EXEND. Reported-by: Martijn Dekker <martijn@inlv.org> Fixes: da30b4b78769 ("[BUILTIN] Exit without arguments in a trap...") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c index 6d53e00..6b3a090 100644 --- a/src/main.c +++ b/src/main.c @@ -111,7 +111,7 @@ main(int argc, char **argv) e = exception; s = state; - if (e == EXEXIT || s == 0 || iflag == 0 || shlvl) + if (e == EXEND || e == EXEXIT || s == 0 || iflag == 0 || shlvl) exitshell(); reset(); |