aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-06-20 12:13:51 +0100
committerRon Yorston <rmy@pobox.com>2020-06-20 12:13:51 +0100
commitda7c8cdf631fc0754d30d5b997ee71a085699469 (patch)
treefdcefbc3e8b4af77a2f4e7d8b0d513bb62354c7d
parent1a322c80f98f932a729d2ef1615b942420e8d62e (diff)
downloadbusybox-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.c9
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
392static struct forkshell* forkshell_prepare(struct forkshell *fs); 392static struct forkshell* forkshell_prepare(struct forkshell *fs);
393static void forkshell_init(const char *idstr); 393static void forkshell_init(const char *idstr);
394static void *sticky_mem_start, *sticky_mem_end;
394static void sticky_free(void *p); 395static 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
16335static void *sticky_mem_start, *sticky_mem_end;
16336static void 16339static void
16337forkshell_init(const char *idstr) 16340forkshell_init(const char *idstr)
16338{ 16341{