From ed7823738cea677a1db59761158ce6918fa34ab2 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 10 Apr 2009 00:45:02 +0000 Subject: fix segfault on syntax error code path --- shell/hush.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'shell') diff --git a/shell/hush.c b/shell/hush.c index 21590ad..db99cc9 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