From 074ebfca2153bf4a1fc6bdf4f3430d989de503c8 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sun, 8 Sep 2024 11:32:25 +0100 Subject: ash: code shrink Allow ash_main() to be invoked directly even in a non-FS_SHELLEXEC shell. Saves 48-64 bytes. --- shell/ash.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/shell/ash.c b/shell/ash.c index d9a7bee83..5f231385a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -9104,11 +9104,9 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c #endif #if ENABLE_FEATURE_SH_STANDALONE if (applet_no >= 0) { + if (ENABLE_PLATFORM_MINGW32 || APPLET_IS_NOEXEC(applet_no)) { # if ENABLE_PLATFORM_MINGW32 - /* Treat all applets as NOEXEC, including the shell itself if - * this is a FS_SHELLEXEC shell. */ - if (applet_main[applet_no] != ash_main || - (fs && fs->fpid == FS_SHELLEXEC)) { + /* Treat all applets as NOEXEC */ run_noexec: /* mingw-w64's getopt() uses __argv[0] as the program name */ __argv[0] = (char *)cmd; @@ -9117,8 +9115,6 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c if (strcmp(argv[0], "which") == 0) { argv[0] = (char *)"Which"; } -# else - if (APPLET_IS_NOEXEC(applet_no)) { # endif #if !ENABLE_PLATFORM_MINGW32 || !defined(_UCRT) /* If building for UCRT move this up into shellexec() to -- cgit v1.2.3-55-g6feb