diff options
author | Ron Yorston <rmy@pobox.com> | 2020-06-20 12:13:51 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-06-20 12:13:51 +0100 |
commit | da7c8cdf631fc0754d30d5b997ee71a085699469 (patch) | |
tree | fdcefbc3e8b4af77a2f4e7d8b0d513bb62354c7d | |
parent | 1a322c80f98f932a729d2ef1615b942420e8d62e (diff) | |
download | busybox-w32-da7c8cdf631fc0754d30d5b997ee71a085699469.tar.gz busybox-w32-da7c8cdf631fc0754d30d5b997ee71a085699469.tar.bz2 busybox-w32-da7c8cdf631fc0754d30d5b997ee71a085699469.zip |
ash: run ash_main() directly from a FS_SHELLEXEC shell
-rw-r--r-- | shell/ash.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index a3b881ed8..f11449530 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -391,6 +391,7 @@ enum { | |||
391 | 391 | ||
392 | static struct forkshell* forkshell_prepare(struct forkshell *fs); | 392 | static struct forkshell* forkshell_prepare(struct forkshell *fs); |
393 | static void forkshell_init(const char *idstr); | 393 | static void forkshell_init(const char *idstr); |
394 | static void *sticky_mem_start, *sticky_mem_end; | ||
394 | static void sticky_free(void *p); | 395 | static void sticky_free(void *p); |
395 | # define free(p) sticky_free(p) | 396 | # define free(p) sticky_free(p) |
396 | #if !JOBS | 397 | #if !JOBS |
@@ -8667,8 +8668,11 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c | |||
8667 | #if ENABLE_FEATURE_SH_STANDALONE | 8668 | #if ENABLE_FEATURE_SH_STANDALONE |
8668 | if (applet_no >= 0) { | 8669 | if (applet_no >= 0) { |
8669 | # if ENABLE_PLATFORM_MINGW32 | 8670 | # if ENABLE_PLATFORM_MINGW32 |
8670 | /* Treat all applets as NOEXEC apart from the shell itself */ | 8671 | /* Treat all applets as NOEXEC, including the shell itself if |
8671 | if (applet_main[applet_no] != ash_main) { | 8672 | * this is a FS_SHELLEXEC shell. */ |
8673 | struct forkshell *fs = (struct forkshell *)sticky_mem_start; | ||
8674 | if (applet_main[applet_no] != ash_main || | ||
8675 | (fs && fs->fpid == FS_SHELLEXEC)) { | ||
8672 | # else | 8676 | # else |
8673 | if (APPLET_IS_NOEXEC(applet_no)) { | 8677 | if (APPLET_IS_NOEXEC(applet_no)) { |
8674 | # endif | 8678 | # endif |
@@ -16332,7 +16336,6 @@ forkshell_prepare(struct forkshell *fs) | |||
16332 | 16336 | ||
16333 | #undef trap | 16337 | #undef trap |
16334 | #undef trap_ptr | 16338 | #undef trap_ptr |
16335 | static void *sticky_mem_start, *sticky_mem_end; | ||
16336 | static void | 16339 | static void |
16337 | forkshell_init(const char *idstr) | 16340 | forkshell_init(const char *idstr) |
16338 | { | 16341 | { |