diff options
author | Ron Yorston <rmy@pobox.com> | 2024-01-23 09:24:38 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-01-23 09:30:11 +0000 |
commit | 99de7009698d868c0d139133ed4fa445be8cae50 (patch) | |
tree | 4f6f18253f799b80ef26add546a40118eec8b193 | |
parent | d7c65f24a9f6cf61a1fc629d5d2d48cc64d5bc41 (diff) | |
download | busybox-w32-99de7009698d868c0d139133ed4fa445be8cae50.tar.gz busybox-w32-99de7009698d868c0d139133ed4fa445be8cae50.tar.bz2 busybox-w32-99de7009698d868c0d139133ed4fa445be8cae50.zip |
Fix POSIX build in standalone shell mode
The conditional compilation to control standalone shell mode was
incorrect when building for POSIX. This hadn't been noticed before
as it had only been tested in the default configuration where
standalone shell mode is disabled.
-rw-r--r-- | include/libbb.h | 5 | ||||
-rw-r--r-- | libbb/lineedit.c | 2 | ||||
-rw-r--r-- | shell/ash.c | 4 |
3 files changed, 7 insertions, 4 deletions
diff --git a/include/libbb.h b/include/libbb.h index 96496169d..2f882aa9d 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1332,9 +1332,10 @@ void run_applet_no_and_exit(int a, const char *name, char **argv) NORETURN FAST_ | |||
1332 | # if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE | 1332 | # if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE |
1333 | int is_applet_preferred(const char *name, const char *path) FAST_FUNC; | 1333 | int is_applet_preferred(const char *name, const char *path) FAST_FUNC; |
1334 | int find_applet_by_name_with_path(const char *name, const char *path) FAST_FUNC; | 1334 | int find_applet_by_name_with_path(const char *name, const char *path) FAST_FUNC; |
1335 | # else | ||
1336 | # define is_applet_preferred(n, p) (1) | ||
1337 | # endif | 1335 | # endif |
1336 | # else | ||
1337 | # define is_applet_preferred(n, p) (1) | ||
1338 | # define find_applet_by_name_with_path(n, p) find_applet_by_name(n) | ||
1338 | # endif | 1339 | # endif |
1339 | #endif | 1340 | #endif |
1340 | void show_usage_if_dash_dash_help(int applet_no, char **argv) FAST_FUNC; | 1341 | void show_usage_if_dash_dash_help(int applet_no, char **argv) FAST_FUNC; |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 976a7d87d..13cbb3229 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -974,8 +974,10 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type) | |||
974 | if (type == FIND_EXE_ONLY && !dirbuf) { | 974 | if (type == FIND_EXE_ONLY && !dirbuf) { |
975 | # if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1 | 975 | # if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1 |
976 | const char *p = applet_names; | 976 | const char *p = applet_names; |
977 | # if ENABLE_PLATFORM_MINGW32 | ||
977 | const char *shpath = state->flags & WITH_PATH_LOOKUP ? | 978 | const char *shpath = state->flags & WITH_PATH_LOOKUP ? |
978 | state->path_lookup : NULL; | 979 | state->path_lookup : NULL; |
980 | # endif | ||
979 | while (*p) { | 981 | while (*p) { |
980 | if (strncmp(basecmd, p, baselen) == 0 && | 982 | if (strncmp(basecmd, p, baselen) == 0 && |
981 | is_applet_preferred(p, shpath)) | 983 | is_applet_preferred(p, shpath)) |
diff --git a/shell/ash.c b/shell/ash.c index e74662d8d..235eb8b7d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -9106,7 +9106,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c | |||
9106 | # else | 9106 | # else |
9107 | if (APPLET_IS_NOEXEC(applet_no)) { | 9107 | if (APPLET_IS_NOEXEC(applet_no)) { |
9108 | # endif | 9108 | # endif |
9109 | #if ENABLE_PLATFORM_MINGW32 && !defined(_UCRT) | 9109 | #if !ENABLE_PLATFORM_MINGW32 || !defined(_UCRT) |
9110 | /* If building for UCRT move this up into shellexec() to | 9110 | /* If building for UCRT move this up into shellexec() to |
9111 | * work around a bug. */ | 9111 | * work around a bug. */ |
9112 | clearenv(); | 9112 | clearenv(); |
@@ -9183,7 +9183,7 @@ static void shellexec(char *prog, char **argv, const char *path, int idx) | |||
9183 | int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */ | 9183 | int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */ |
9184 | 9184 | ||
9185 | envp = listvars(VEXPORT, VUNSET, /*strlist:*/ NULL, /*end:*/ NULL); | 9185 | envp = listvars(VEXPORT, VUNSET, /*strlist:*/ NULL, /*end:*/ NULL); |
9186 | #if ENABLE_PLATFORM_MINGW32 && defined(_UCRT) | 9186 | #if ENABLE_FEATURE_SH_STANDALONE && ENABLE_PLATFORM_MINGW32 && defined(_UCRT) |
9187 | /* Avoid UCRT bug by updating parent's environment and passing a | 9187 | /* Avoid UCRT bug by updating parent's environment and passing a |
9188 | * NULL environment pointer to execve(). */ | 9188 | * NULL environment pointer to execve(). */ |
9189 | clearenv(); | 9189 | clearenv(); |