summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2007-01-18 01:12:57 +0000
committerDenis Vlasenko2007-01-18 01:12:57 +0000
commit7f0d7ae4f55a810d57ef07d5cd964435dd87e6dc (patch)
treebb671c9ac416e241e2aff7fabeaa2960f73406dc
parent41aaefce71bfdfb7d788c29e9df90971eecc8193 (diff)
downloadbusybox-7f0d7ae4f55a810d57ef07d5cd964435dd87e6dc.zip
busybox-7f0d7ae4f55a810d57ef07d5cd964435dd87e6dc.tar.gz
fix subtle bug inherited from dash
-rw-r--r--shell/ash.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 95928e9..8ef8c46 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11938,7 +11938,11 @@ exitshell(void)
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 @@ exitshell(void)
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 */
}