From c3bdb8b1a640c740ed6a2aacc0bd4ce0740809ab Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 14 Apr 2010 00:43:59 +0200 Subject: win32: ash: find_command(): also find .exe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nguyễn Thái Ngọc Duy --- shell/ash.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index dcf6fcbcb..a54284155 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -12362,6 +12362,25 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) TRACE(("searchexec \"%s\": no change\n", name)); goto success; } +#if ENABLE_PLATFORM_MINGW32 + len = strlen(fullname); + if (len > 4 && + !strcasecmp(fullname+len-4, ".exe") && + stat(fullname, &statb) < 0) { + if (errno != ENOENT && errno != ENOTDIR) + e = errno; + goto loop; + } + + /* path_advance() has reserved space for .exe */ + memcpy(fullname+len, ".exe", 5); + if (stat(fullname, &statb) < 0) { + if (errno != ENOENT && errno != ENOTDIR) + e = errno; + goto loop; + } + fullname[len] = '\0'; +#else while (stat(fullname, &statb) < 0) { #ifdef SYSV if (errno == EINTR) @@ -12371,6 +12390,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) e = errno; goto loop; } +#endif e = EACCES; /* if we fail, this will be the error */ if (!S_ISREG(statb.st_mode)) continue; -- cgit v1.2.3-55-g6feb