aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-04-24 11:25:30 +0100
committerRon Yorston <rmy@pobox.com>2022-04-24 11:25:30 +0100
commit2211b446d8ba209d75974a6835aecda3d8358047 (patch)
tree35bd8d2483661a5aac99a9a8c04146c37e59ec59
parentbd43e03eaaf685aec32dbb8997d6d27679215d2b (diff)
downloadbusybox-w32-2211b446d8ba209d75974a6835aecda3d8358047.tar.gz
busybox-w32-2211b446d8ba209d75974a6835aecda3d8358047.tar.bz2
busybox-w32-2211b446d8ba209d75974a6835aecda3d8358047.zip
ash: avoid misleading '.exe' in standalone shell mode
In dash a command with an explicit path has an index value of -1 in its cmdentry structure. Upstream BusyBox extends this to allow other negative values for applets in standalone shell mode. busybox-w32 adds a further extension, with the index value INT_MIN indicating an applet with a Unix-style path. In describe_command() the command should only have a '.exe' extension added for index == -1, the original dash case of an explicit path. (GitHub issue #248)
-rw-r--r--shell/ash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 35aa3f6e6..afb865146 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9454,7 +9454,7 @@ describe_command(char *command, const char *path, int describe_command_verbose)
9454 int j = entry.u.index; 9454 int j = entry.u.index;
9455 char *p; 9455 char *p;
9456#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE 9456#if ENABLE_PLATFORM_MINGW32 && ENABLE_FEATURE_SH_STANDALONE
9457 if (j == INT_MIN) { 9457 if (j < -1) {
9458 p = (char *)bb_basename(command); 9458 p = (char *)bb_basename(command);
9459 goto describe; 9459 goto describe;
9460 } 9460 }