From 62cf6955f8abe875752d7163f6f3adbc7e49ebae Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Fri, 14 Dec 2018 13:52:02 +0800 Subject: 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 Fixes: da30b4b78769 ("[BUILTIN] Exit without arguments in a trap...") Signed-off-by: Herbert Xu --- src/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/exec.c') diff --git a/src/exec.c b/src/exec.c index 9d0215a..87354d4 100644 --- a/src/exec.c +++ b/src/exec.c @@ -143,7 +143,7 @@ shellexec(char **argv, const char *path, int idx) exitstatus = exerrno; TRACE(("shellexec failed for %s, errno %d, suppressint %d\n", argv[0], e, suppressint )); - exerror(EXEXIT, "%s: %s", argv[0], errmsg(e, E_EXEC)); + exerror(EXEND, "%s: %s", argv[0], errmsg(e, E_EXEC)); /* NOTREACHED */ } -- cgit 1.4.1