mirror of
https://github.com/topjohnwu/ndk-busybox.git
synced 2024-11-25 04:39:48 +00:00
fix subtle bug inherited from dash
This commit is contained in:
parent
41aaefce71
commit
7f0d7ae4f5
12
shell/ash.c
12
shell/ash.c
@ -11938,7 +11938,11 @@ exitshell(void)
|
|||||||
TRACE(("pid %d, exitshell(%d)\n", getpid(), status));
|
TRACE(("pid %d, exitshell(%d)\n", getpid(), status));
|
||||||
if (setjmp(loc.loc)) {
|
if (setjmp(loc.loc)) {
|
||||||
if (exception == EXEXIT)
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
handler = &loc;
|
handler = &loc;
|
||||||
@ -11947,16 +11951,16 @@ exitshell(void)
|
|||||||
evalstring(p, 0);
|
evalstring(p, 0);
|
||||||
}
|
}
|
||||||
flushall();
|
flushall();
|
||||||
setjobctl(0);
|
|
||||||
#ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
|
#ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
|
||||||
if (iflag && rootshell) {
|
if (iflag && rootshell) {
|
||||||
const char *hp = lookupvar("HISTFILE");
|
const char *hp = lookupvar("HISTFILE");
|
||||||
|
|
||||||
if(hp != NULL )
|
if (hp != NULL)
|
||||||
save_history ( hp );
|
save_history(hp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
out:
|
out:
|
||||||
|
setjobctl(0);
|
||||||
_exit(status);
|
_exit(status);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user