svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Thu Jan 18 01:12:58 UTC 2007


Author: vda
Date: 2007-01-17 17:12:57 -0800 (Wed, 17 Jan 2007)
New Revision: 17360

Log:
fix subtle bug inherited from dash


Modified:
   trunk/busybox/shell/ash.c


Changeset:
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c	2007-01-18 00:53:35 UTC (rev 17359)
+++ trunk/busybox/shell/ash.c	2007-01-18 01:12:57 UTC (rev 17360)
@@ -11938,7 +11938,11 @@
 	TRACE(("pid %d, exitshell(%d)\n", getpid(), status));
 	if (setjmp(loc.loc)) {
 		if (exception == EXEXIT)
-			_exit(exitstatus);
+/* dash bug: it just does _exit(exitstatus) here
+ * but we have to do setjobctl(0) first!
+ * (bug is still not fixed in dash-0.5.3 - if you run dash
+ * under Midnight Commander, on exit MC is backgrounded) */
+			status = exitstatus;
 		goto out;
 	}
 	handler = &loc;
@@ -11947,16 +11951,16 @@
 		evalstring(p, 0);
 	}
 	flushall();
-	setjobctl(0);
 #ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
 	if (iflag && rootshell) {
 		const char *hp = lookupvar("HISTFILE");
 
-		if(hp != NULL )
-			save_history ( hp );
+		if (hp != NULL)
+			save_history(hp);
 	}
 #endif
 out:
+	setjobctl(0);
 	_exit(status);
 	/* NOTREACHED */
 }




More information about the busybox-cvs mailing list