svn commit: [26052] trunk/busybox/shell

vda at busybox.net vda at busybox.net
Fri Apr 10 00:45:02 UTC 2009


Author: vda
Date: 2009-04-10 00:45:02 +0000 (Fri, 10 Apr 2009)
New Revision: 26052

Log:
fix segfault on syntax error code path



Modified:
   trunk/busybox/shell/hush.c


Changeset:
Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c	2009-04-10 00:20:58 UTC (rev 26051)
+++ trunk/busybox/shell/hush.c	2009-04-10 00:45:02 UTC (rev 26052)
@@ -5587,6 +5587,13 @@
 	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 @@
 		/* -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 */



More information about the busybox-cvs mailing list