diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-12 15:38:04 +0200 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2010-09-12 15:38:04 +0200 |
commit | a110c90de2f56bf38de30972813f012d44042cb9 (patch) | |
tree | e10506003010cd97df9db623912abb74c409d54c /shell/hush.c | |
parent | 2d8187c139985e73349e3cb092ab4ea68a3be034 (diff) | |
download | busybox-w32-a110c90de2f56bf38de30972813f012d44042cb9.tar.gz busybox-w32-a110c90de2f56bf38de30972813f012d44042cb9.tar.bz2 busybox-w32-a110c90de2f56bf38de30972813f012d44042cb9.zip |
hush: fix EXIT trap display inside exit trap handler
function old new delta
hush_exit 84 78 -6
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c index b01f90370..3ad87b19b 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -1357,10 +1357,10 @@ static void hush_exit(int exitcode) | |||
1357 | /* argv[0] is unused */ | 1357 | /* argv[0] is unused */ |
1358 | argv[1] = G.traps[0]; | 1358 | argv[1] = G.traps[0]; |
1359 | argv[2] = NULL; | 1359 | argv[2] = NULL; |
1360 | G.traps[0] = NULL; | 1360 | G.exiting = 1; /* prevent EXIT trap recursion */ |
1361 | G.exiting = 1; | ||
1362 | builtin_eval(argv); | 1361 | builtin_eval(argv); |
1363 | /* free(argv[1]); - why bother */ | 1362 | /* Note: G.traps[0] is not cleared! |
1363 | * "trap" will still show it */ | ||
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | #if ENABLE_HUSH_JOB | 1366 | #if ENABLE_HUSH_JOB |
@@ -7864,7 +7864,7 @@ static int FAST_FUNC builtin_exit(char **argv) | |||
7864 | * exit | 7864 | * exit |
7865 | # EEE (then bash exits) | 7865 | # EEE (then bash exits) |
7866 | * | 7866 | * |
7867 | * we can use G.exiting = -1 as indicator "last cmd was exit" | 7867 | * TODO: we can use G.exiting = -1 as indicator "last cmd was exit" |
7868 | */ | 7868 | */ |
7869 | 7869 | ||
7870 | /* note: EXIT trap is run by hush_exit */ | 7870 | /* note: EXIT trap is run by hush_exit */ |