aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-06-09 16:26:34 +0100
committerRon Yorston <rmy@pobox.com>2020-06-09 16:52:45 +0100
commit32833bc06873f83c786232617b4390b60252c417 (patch)
tree8f175374e2f43538ab65c5b5b550cd10d71bc0de /shell
parent4fe76647b356a85810fa3d355d7ad0512be1210c (diff)
downloadbusybox-w32-32833bc06873f83c786232617b4390b60252c417.tar.gz
busybox-w32-32833bc06873f83c786232617b4390b60252c417.tar.bz2
busybox-w32-32833bc06873f83c786232617b4390b60252c417.zip
ash: treat all applets as NOEXEC
In standalone shell mode tryexec() treats all applets as NOEXEC. Except for the shell: calling ash_main() recursively seems unwise. This avoids creating a new process for the applet (which is a Good Thing on Microsoft Windows where creating processes is expensive) but leaves the resources used by the invoking shell in the current process.
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index e21131b01..d76d3f571 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8666,7 +8666,12 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c
8666{ 8666{
8667#if ENABLE_FEATURE_SH_STANDALONE 8667#if ENABLE_FEATURE_SH_STANDALONE
8668 if (applet_no >= 0) { 8668 if (applet_no >= 0) {
8669# if ENABLE_PLATFORM_MINGW32
8670 /* Treat all applets as NOEXEC apart from the shell itself */
8671 if (applet_main[applet_no] != ash_main) {
8672# else
8669 if (APPLET_IS_NOEXEC(applet_no)) { 8673 if (APPLET_IS_NOEXEC(applet_no)) {
8674# endif
8670 clearenv(); 8675 clearenv();
8671 while (*envp) 8676 while (*envp)
8672 putenv(*envp++); 8677 putenv(*envp++);