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/error.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/error.h') diff --git a/src/error.h b/src/error.h index 9630b56..94e30a2 100644 --- a/src/error.h +++ b/src/error.h @@ -66,7 +66,8 @@ extern int exception; /* exceptions */ #define EXINT 0 /* SIGINT received */ #define EXERROR 1 /* a generic error */ -#define EXEXIT 4 /* exit the shell */ +#define EXEND 3 /* exit the shell */ +#define EXEXIT 4 /* exit the shell via exitcmd */ /* -- cgit 1.4.1