diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-14 00:43:59 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-20 19:14:42 +0200 |
commit | c3bdb8b1a640c740ed6a2aacc0bd4ce0740809ab (patch) | |
tree | 6b762981aa29f7f6d0626b6c7e98d3447aa755a4 /shell | |
parent | 1430ca443d2c8e60dd3d4c579209012d1e347b42 (diff) | |
download | busybox-w32-c3bdb8b1a640c740ed6a2aacc0bd4ce0740809ab.tar.gz busybox-w32-c3bdb8b1a640c740ed6a2aacc0bd4ce0740809ab.tar.bz2 busybox-w32-c3bdb8b1a640c740ed6a2aacc0bd4ce0740809ab.zip |
win32: ash: find_command(): also find .exe
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 20 |
1 files changed, 20 insertions, 0 deletions
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) | |||
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 && | ||
12368 | !strcasecmp(fullname+len-4, ".exe") && | ||
12369 | stat(fullname, &statb) < 0) { | ||
12370 | if (errno != ENOENT && errno != ENOTDIR) | ||
12371 | e = errno; | ||
12372 | goto loop; | ||
12373 | } | ||
12374 | |||
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 | #else | ||
12365 | while (stat(fullname, &statb) < 0) { | 12384 | while (stat(fullname, &statb) < 0) { |
12366 | #ifdef SYSV | 12385 | #ifdef SYSV |
12367 | if (errno == EINTR) | 12386 | if (errno == EINTR) |
@@ -12371,6 +12390,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
12371 | e = errno; | 12390 | e = errno; |
12372 | goto loop; | 12391 | goto loop; |
12373 | } | 12392 | } |
12393 | #endif | ||
12374 | e = EACCES; /* if we fail, this will be the error */ | 12394 | e = EACCES; /* if we fail, this will be the error */ |
12375 | if (!S_ISREG(statb.st_mode)) | 12395 | if (!S_ISREG(statb.st_mode)) |
12376 | continue; | 12396 | continue; |