aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2009-04-10 00:45:02 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2009-04-10 00:45:02 +0000
commited7823738cea677a1db59761158ce6918fa34ab2 (patch)
tree34be8dc6f6ba69f47397fafe5a655d1bab119f4a /shell
parentc96865f4458f357df41eeea73d456e15755b51f4 (diff)
downloadbusybox-ed7823738cea677a1db59761158ce6918fa34ab2.tar.gz
fix segfault on syntax error code path
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c13
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)
G.PS2 = "> ";
#endif
+ if (setjmp(die_jmp)) {
+ /* xfunc has failed! die die die */
+ /* no EXIT traps, this is an escape hatch! */
+ G.exiting = 1;
+ hush_exit(xfunc_error_retval);
+ }
+
/* Shell is non-interactive at first. We need to call
* block_signals(0) if we are going to execute "sh <script>",
* "sh -c <cmds>" or login shell's /etc/profile and friends.
@@ -5774,12 +5781,6 @@ int hush_main(int argc, char **argv)
/* -1 is special - makes xfuncs longjmp, not exit
* (we reset die_sleep = 0 whereever we [v]fork) */
enable_restore_tty_pgrp_on_exit(); /* sets die_sleep = -1 */
- if (setjmp(die_jmp)) {
- /* xfunc has failed! die die die */
- /* no EXIT traps, this is an escape hatch! */
- G.exiting = 1;
- hush_exit(xfunc_error_retval);
- }
} else if (!signal_mask_is_inited) {
block_signals(0); /* 0: called 1st time */
} /* else: block_signals(0) was done before */