summaryrefslogtreecommitdiffstats
path: root/bin/sh/trap.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh/trap.c')
-rw-r--r--bin/sh/trap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c
index 0a9eb60..6c4cbbe 100644
--- a/bin/sh/trap.c
+++ b/bin/sh/trap.c
@@ -455,7 +455,6 @@ dotrap(void)
last_trapsig = i;
savestatus = exitstatus;
evalstring(trap[i], 0);
- exitstatus = savestatus;
/*
* If such a command was not
@@ -464,9 +463,11 @@ dotrap(void)
* trap action to have an effect
* outside of it.
*/
- if (prev_evalskip != 0) {
+ if (evalskip == 0 ||
+ prev_evalskip != 0) {
evalskip = prev_evalskip;
skipcount = prev_skipcount;
+ exitstatus = savestatus;
}
if (i == SIGCHLD)
OpenPOWER on IntegriCloud