diff options
Diffstat (limited to 'libbb/executable.c')
-rw-r--r-- | libbb/executable.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/libbb/executable.c b/libbb/executable.c index 29d2a2c85..87a40eeda 100644 --- a/libbb/executable.c +++ b/libbb/executable.c | |||
@@ -39,19 +39,29 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) | |||
39 | * following the rest of the list. | 39 | * following the rest of the list. |
40 | */ | 40 | */ |
41 | char *p, *n; | 41 | char *p, *n; |
42 | #if ENABLE_PLATFORM_MINGW32 | ||
43 | char *w; | ||
44 | #endif | ||
42 | 45 | ||
43 | p = *PATHp; | 46 | p = *PATHp; |
44 | while (p) { | 47 | while (p) { |
45 | int ex; | 48 | int ex; |
46 | 49 | ||
47 | n = strchr(p, ':'); | 50 | n = strchr(p, PATH_SEP); |
48 | if (n) *n = '\0'; | 51 | if (n) *n = '\0'; |
49 | p = concat_path_file( | 52 | p = concat_path_file( |
50 | p[0] ? p : ".", /* handle "::" case */ | 53 | p[0] ? p : ".", /* handle "::" case */ |
51 | filename | 54 | filename |
52 | ); | 55 | ); |
56 | if (n) *n++ = PATH_SEP; | ||
57 | #if ENABLE_PLATFORM_MINGW32 | ||
58 | if ((w=alloc_win32_extension(p))) { | ||
59 | free(p); | ||
60 | p = w; | ||
61 | /* following test will succeed */ | ||
62 | } | ||
63 | #endif | ||
53 | ex = file_is_executable(p); | 64 | ex = file_is_executable(p); |
54 | if (n) *n++ = ':'; | ||
55 | if (ex) { | 65 | if (ex) { |
56 | *PATHp = n; | 66 | *PATHp = n; |
57 | return p; | 67 | return p; |