diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/shell/ash.c b/shell/ash.c index af0c68dcf..e47836d70 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -13564,10 +13564,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
13564 | goto success; | 13564 | goto success; |
13565 | } | 13565 | } |
13566 | #if ENABLE_PLATFORM_MINGW32 | 13566 | #if ENABLE_PLATFORM_MINGW32 |
13567 | len = strlen(fullname); | 13567 | if (has_exe_suffix(fullname)) { |
13568 | if (len > 4 && | ||
13569 | (!strcasecmp(fullname+len-4, ".exe") || | ||
13570 | !strcasecmp(fullname+len-4, ".com"))) { | ||
13571 | if (stat(fullname, &statb) < 0) { | 13568 | if (stat(fullname, &statb) < 0) { |
13572 | if (errno != ENOENT && errno != ENOTDIR) | 13569 | if (errno != ENOENT && errno != ENOTDIR) |
13573 | e = errno; | 13570 | e = errno; |
@@ -13576,14 +13573,12 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
13576 | } | 13573 | } |
13577 | else { | 13574 | else { |
13578 | /* path_advance() has reserved space for .exe */ | 13575 | /* path_advance() has reserved space for .exe */ |
13579 | memcpy(fullname+len, ".exe", 5); | 13576 | len = strlen(fullname); |
13577 | strcat(fullname, ".exe"); | ||
13580 | if (stat(fullname, &statb) < 0) { | 13578 | if (stat(fullname, &statb) < 0) { |
13581 | if (errno != ENOENT && errno != ENOTDIR) | ||
13582 | e = errno; | ||
13583 | memcpy(fullname+len, ".com", 5); | 13579 | memcpy(fullname+len, ".com", 5); |
13584 | if (stat(fullname, &statb) < 0) { | 13580 | if (stat(fullname, &statb) < 0) { |
13585 | if (errno != ENOENT && errno != ENOTDIR) | 13581 | /* check for script */ |
13586 | e = errno; | ||
13587 | fullname[len] = '\0'; | 13582 | fullname[len] = '\0'; |
13588 | if (stat(fullname, &statb) < 0) { | 13583 | if (stat(fullname, &statb) < 0) { |
13589 | if (errno != ENOENT && errno != ENOTDIR) | 13584 | if (errno != ENOENT && errno != ENOTDIR) |