diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-10 00:45:02 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-10 00:45:02 +0000 |
commit | ed7823738cea677a1db59761158ce6918fa34ab2 (patch) | |
tree | 34be8dc6f6ba69f47397fafe5a655d1bab119f4a | |
parent | c96865f4458f357df41eeea73d456e15755b51f4 (diff) | |
download | busybox-w32-ed7823738cea677a1db59761158ce6918fa34ab2.tar.gz busybox-w32-ed7823738cea677a1db59761158ce6918fa34ab2.tar.bz2 busybox-w32-ed7823738cea677a1db59761158ce6918fa34ab2.zip |
fix segfault on syntax error code path
-rw-r--r-- | shell/hush.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/shell/hush.c b/shell/hush.c index 21590adfb..db99cc908 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -5587,6 +5587,13 @@ int hush_main(int argc, char **argv) | |||
5587 | G.PS2 = "> "; | 5587 | G.PS2 = "> "; |
5588 | #endif | 5588 | #endif |
5589 | 5589 | ||
5590 | if (setjmp(die_jmp)) { | ||
5591 | /* xfunc has failed! die die die */ | ||
5592 | /* no EXIT traps, this is an escape hatch! */ | ||
5593 | G.exiting = 1; | ||
5594 | hush_exit(xfunc_error_retval); | ||
5595 | } | ||
5596 | |||
5590 | /* Shell is non-interactive at first. We need to call | 5597 | /* Shell is non-interactive at first. We need to call |
5591 | * block_signals(0) if we are going to execute "sh <script>", | 5598 | * block_signals(0) if we are going to execute "sh <script>", |
5592 | * "sh -c <cmds>" or login shell's /etc/profile and friends. | 5599 | * "sh -c <cmds>" or login shell's /etc/profile and friends. |
@@ -5774,12 +5781,6 @@ int hush_main(int argc, char **argv) | |||
5774 | /* -1 is special - makes xfuncs longjmp, not exit | 5781 | /* -1 is special - makes xfuncs longjmp, not exit |
5775 | * (we reset die_sleep = 0 whereever we [v]fork) */ | 5782 | * (we reset die_sleep = 0 whereever we [v]fork) */ |
5776 | enable_restore_tty_pgrp_on_exit(); /* sets die_sleep = -1 */ | 5783 | enable_restore_tty_pgrp_on_exit(); /* sets die_sleep = -1 */ |
5777 | if (setjmp(die_jmp)) { | ||
5778 | /* xfunc has failed! die die die */ | ||
5779 | /* no EXIT traps, this is an escape hatch! */ | ||
5780 | G.exiting = 1; | ||
5781 | hush_exit(xfunc_error_retval); | ||
5782 | } | ||
5783 | } else if (!signal_mask_is_inited) { | 5784 | } else if (!signal_mask_is_inited) { |
5784 | block_signals(0); /* 0: called 1st time */ | 5785 | block_signals(0); /* 0: called 1st time */ |
5785 | } /* else: block_signals(0) was done before */ | 5786 | } /* else: block_signals(0) was done before */ |