diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index cdbbeba33..b4e7b78a8 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -11265,13 +11265,33 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
11265 | #endif | 11265 | #endif |
11266 | if (errno != ENOENT && errno != ENOTDIR) | 11266 | if (errno != ENOENT && errno != ENOTDIR) |
11267 | e = errno; | 11267 | e = errno; |
11268 | #ifdef __MINGW32__ | ||
11269 | if (!strchr(name, '.')) { | ||
11270 | int len = strlen(fullname); | ||
11271 | fullname = stalloc(strlen(fullname) + 5); | ||
11272 | memcpy(fullname+len, ".exe", 5); | ||
11273 | stunalloc(fullname); | ||
11274 | while (stat(fullname, &statb) < 0) { | ||
11275 | #ifdef SYSV | ||
11276 | if (errno == EINTR) | ||
11277 | continue; | ||
11278 | #endif | ||
11279 | if (errno != ENOENT && errno != ENOTDIR) | ||
11280 | e = errno; | ||
11281 | |||
11282 | goto loop; | ||
11283 | } | ||
11284 | |||
11285 | break; | ||
11286 | } | ||
11287 | #endif | ||
11268 | goto loop; | 11288 | goto loop; |
11269 | } | 11289 | } |
11270 | e = EACCES; /* if we fail, this will be the error */ | 11290 | e = EACCES; /* if we fail, this will be the error */ |
11271 | if (!S_ISREG(statb.st_mode)) | 11291 | if (!S_ISREG(statb.st_mode)) |
11272 | continue; | 11292 | continue; |
11273 | if (pathopt) { /* this is a %func directory */ | 11293 | if (pathopt) { /* this is a %func directory */ |
11274 | stalloc(strlen(fullname) + 1); | 11294 | fullname = stalloc(strlen(fullname) + 1); |
11275 | readcmdfile(fullname); | 11295 | readcmdfile(fullname); |
11276 | cmdp = cmdlookup(name, 0); | 11296 | cmdp = cmdlookup(name, 0); |
11277 | if (cmdp == NULL || cmdp->cmdtype != CMDFUNCTION) | 11297 | if (cmdp == NULL || cmdp->cmdtype != CMDFUNCTION) |