diff options
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index dcf6fcbcb..1b448371d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -12362,6 +12362,26 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
| 12362 | TRACE(("searchexec \"%s\": no change\n", name)); | 12362 | TRACE(("searchexec \"%s\": no change\n", name)); |
| 12363 | goto success; | 12363 | goto success; |
| 12364 | } | 12364 | } |
| 12365 | #if ENABLE_PLATFORM_MINGW32 | ||
| 12366 | len = strlen(fullname); | ||
| 12367 | if (len > 4 && !strcasecmp(fullname+len-4, ".exe")) { | ||
| 12368 | if (stat(fullname, &statb) < 0) { | ||
| 12369 | if (errno != ENOENT && errno != ENOTDIR) | ||
| 12370 | e = errno; | ||
| 12371 | goto loop; | ||
| 12372 | } | ||
| 12373 | } | ||
| 12374 | else { | ||
| 12375 | /* path_advance() has reserved space for .exe */ | ||
| 12376 | memcpy(fullname+len, ".exe", 5); | ||
| 12377 | if (stat(fullname, &statb) < 0) { | ||
| 12378 | if (errno != ENOENT && errno != ENOTDIR) | ||
| 12379 | e = errno; | ||
| 12380 | goto loop; | ||
| 12381 | } | ||
| 12382 | fullname[len] = '\0'; | ||
| 12383 | } | ||
| 12384 | #else | ||
| 12365 | while (stat(fullname, &statb) < 0) { | 12385 | while (stat(fullname, &statb) < 0) { |
| 12366 | #ifdef SYSV | 12386 | #ifdef SYSV |
| 12367 | if (errno == EINTR) | 12387 | if (errno == EINTR) |
| @@ -12371,6 +12391,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
| 12371 | e = errno; | 12391 | e = errno; |
| 12372 | goto loop; | 12392 | goto loop; |
| 12373 | } | 12393 | } |
| 12394 | #endif | ||
| 12374 | e = EACCES; /* if we fail, this will be the error */ | 12395 | e = EACCES; /* if we fail, this will be the error */ |
| 12375 | if (!S_ISREG(statb.st_mode)) | 12396 | if (!S_ISREG(statb.st_mode)) |
| 12376 | continue; | 12397 | continue; |
