diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-24 03:09:26 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-09-24 03:09:26 +0200 |
commit | 0800e3af75461c6322427dab53d3526066453b04 (patch) | |
tree | 35e36872f94901b85b6635d515302e0199800e64 | |
parent | 718854025735db26a0dda9e6acfe785d2004b3bc (diff) | |
download | busybox-w32-0800e3af75461c6322427dab53d3526066453b04.tar.gz busybox-w32-0800e3af75461c6322427dab53d3526066453b04.tar.bz2 busybox-w32-0800e3af75461c6322427dab53d3526066453b04.zip |
ash: do not let EXIT trap to fire in `trap`
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index 597bc2808..47f968b54 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -4525,7 +4525,7 @@ clear_traps(void) | |||
4525 | INT_OFF; | 4525 | INT_OFF; |
4526 | free(*tp); | 4526 | free(*tp); |
4527 | *tp = NULL; | 4527 | *tp = NULL; |
4528 | if (tp != &trap[0]) | 4528 | if ((tp - trap) != 0) |
4529 | setsignal(tp - trap); | 4529 | setsignal(tp - trap); |
4530 | INT_ON; | 4530 | INT_ON; |
4531 | } | 4531 | } |
@@ -4596,6 +4596,8 @@ forkchild(struct job *jp, union node *n, int mode) | |||
4596 | * | 4596 | * |
4597 | * Our solution: ONLY bare $(trap) or `trap` is special. | 4597 | * Our solution: ONLY bare $(trap) or `trap` is special. |
4598 | */ | 4598 | */ |
4599 | free(trap[0]); /* Prevent EXIT trap from firing in `trap` */ | ||
4600 | trap[0] = NULL; | ||
4599 | } else { | 4601 | } else { |
4600 | clear_traps(); | 4602 | clear_traps(); |
4601 | } | 4603 | } |
@@ -13023,6 +13025,7 @@ exitshell(void) | |||
13023 | if (p) { | 13025 | if (p) { |
13024 | trap[0] = NULL; | 13026 | trap[0] = NULL; |
13025 | evalstring(p, 0); | 13027 | evalstring(p, 0); |
13028 | free(p); | ||
13026 | } | 13029 | } |
13027 | flush_stdout_stderr(); | 13030 | flush_stdout_stderr(); |
13028 | out: | 13031 | out: |