aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-11-28 20:44:37 +0800
committermaximilian attems <max@stro.at>2011-06-03 18:44:13 +0200
commite607e36944b1ce4ca6696e5ef18eb2da8f0c6d9f (patch)
tree939e8930c9ff907fc86595f3225e611d39392364
parent213764f2200803311a363b98a5664c31292f3363 (diff)
downloadklibc-e607e36944b1ce4ca6696e5ef18eb2da8f0c6d9f.tar.gz
[klibc] [BUILTIN] Use EXEXIT in place of EXEXEC
The intended semantics of EXEXEC are identical to EXEXIT, so simplify by using EXEXIT directly. Functional change: in edge cases (exec within a trap handler), this causes the exit status from exec not to be clobbered. For example, without this patch: $ sh -c 'trap "exec nonexistent" EXIT'; echo $? exec: 1: nonexistent: not found 0 And with it: $ sh -c 'trap "exec nonexistent" EXIT'; echo $? exec: 1: nonexistent: not found 127 Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r--usr/dash/error.h1
-rw-r--r--usr/dash/eval.c2
-rw-r--r--usr/dash/exec.c2
3 files changed, 2 insertions, 3 deletions
diff --git a/usr/dash/error.h b/usr/dash/error.h
index 8b96c2ca7255e..8437ded26e158 100644
--- a/usr/dash/error.h
+++ b/usr/dash/error.h
@@ -70,7 +70,6 @@ extern int exception;
#define EXINT 0 /* SIGINT received */
#define EXERROR 1 /* a generic error */
#define EXSHELLPROC 2 /* execute a shell procedure */
-#define EXEXEC 3 /* command execution failed */
#define EXEXIT 4 /* exit the shell */
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index cd81ce06d4505..3866a4a3a238e 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -862,7 +862,7 @@ bail:
int i;
i = exception;
- if (i == EXEXIT || i == EXEXEC)
+ if (i == EXEXIT)
goto raise;
status = (i == EXINT) ? SIGINT + 128 : 2;
diff --git a/usr/dash/exec.c b/usr/dash/exec.c
index 42299ea653aee..b2734203924c7 100644
--- a/usr/dash/exec.c
+++ b/usr/dash/exec.c
@@ -141,7 +141,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(EXEXEC, "%s: %s", argv[0], errmsg(e, E_EXEC));
+ exerror(EXEXIT, "%s: %s", argv[0], errmsg(e, E_EXEC));
/* NOTREACHED */
}