aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-09-08 11:32:25 +0100
committerRon Yorston <rmy@pobox.com>2024-09-08 11:32:25 +0100
commit074ebfca2153bf4a1fc6bdf4f3430d989de503c8 (patch)
tree1fa4dd5f780c886f55392f77ada033f3f6222fe7
parentcbfa58d56c3ca59538bf23e30105ce27ed5ef948 (diff)
downloadbusybox-w32-074ebfca2153bf4a1fc6bdf4f3430d989de503c8.tar.gz
busybox-w32-074ebfca2153bf4a1fc6bdf4f3430d989de503c8.tar.bz2
busybox-w32-074ebfca2153bf4a1fc6bdf4f3430d989de503c8.zip
ash: code shrink
Allow ash_main() to be invoked directly even in a non-FS_SHELLEXEC shell. Saves 48-64 bytes.
-rw-r--r--shell/ash.c8
1 files 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
9104#endif 9104#endif
9105#if ENABLE_FEATURE_SH_STANDALONE 9105#if ENABLE_FEATURE_SH_STANDALONE
9106 if (applet_no >= 0) { 9106 if (applet_no >= 0) {
9107 if (ENABLE_PLATFORM_MINGW32 || APPLET_IS_NOEXEC(applet_no)) {
9107# if ENABLE_PLATFORM_MINGW32 9108# if ENABLE_PLATFORM_MINGW32
9108 /* Treat all applets as NOEXEC, including the shell itself if 9109 /* Treat all applets as NOEXEC */
9109 * this is a FS_SHELLEXEC shell. */
9110 if (applet_main[applet_no] != ash_main ||
9111 (fs && fs->fpid == FS_SHELLEXEC)) {
9112 run_noexec: 9110 run_noexec:
9113 /* mingw-w64's getopt() uses __argv[0] as the program name */ 9111 /* mingw-w64's getopt() uses __argv[0] as the program name */
9114 __argv[0] = (char *)cmd; 9112 __argv[0] = (char *)cmd;
@@ -9117,8 +9115,6 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c
9117 if (strcmp(argv[0], "which") == 0) { 9115 if (strcmp(argv[0], "which") == 0) {
9118 argv[0] = (char *)"Which"; 9116 argv[0] = (char *)"Which";
9119 } 9117 }
9120# else
9121 if (APPLET_IS_NOEXEC(applet_no)) {
9122# endif 9118# endif
9123#if !ENABLE_PLATFORM_MINGW32 || !defined(_UCRT) 9119#if !ENABLE_PLATFORM_MINGW32 || !defined(_UCRT)
9124 /* If building for UCRT move this up into shellexec() to 9120 /* If building for UCRT move this up into shellexec() to