diff options
author | Ron Yorston <rmy@pobox.com> | 2018-02-28 19:57:02 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-02-28 20:23:18 +0000 |
commit | f5783ef14f9ad96ae483f16e639953d0212ca7d0 (patch) | |
tree | 521ecd0a4cfa4c789f559fcef3982271d3c21bf6 /libbb | |
parent | 92dbd3c0932abbfb6814554603abd38e3eb9d953 (diff) | |
download | busybox-w32-f5783ef14f9ad96ae483f16e639953d0212ca7d0.tar.gz busybox-w32-f5783ef14f9ad96ae483f16e639953d0212ca7d0.tar.bz2 busybox-w32-f5783ef14f9ad96ae483f16e639953d0212ca7d0.zip |
win32: additional improvements to handling of executables
Consistent processing of file extensions, as described in the previous
commit, has been applied to the 'which' applet and the functions
find_executable and mingw_spawn_interpreter.
In spawnveq check that the file to be executed exists and is executable,
and ensure that it won't have any extensions added by spawnve.
It's intended that all files passed to spawnve should have their names
fully specified. If this isn't the case the tests here will cause errors
which will need to be fixed.
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/executable.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libbb/executable.c b/libbb/executable.c index 76b10f790..aec829945 100644 --- a/libbb/executable.c +++ b/libbb/executable.c | |||
@@ -66,23 +66,23 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) | |||
66 | p[0] ? p : ".", /* handle "::" case */ | 66 | p[0] ? p : ".", /* handle "::" case */ |
67 | filename | 67 | filename |
68 | ); | 68 | ); |
69 | ex = file_is_executable(p); | ||
70 | #if ENABLE_PLATFORM_MINGW32 | 69 | #if ENABLE_PLATFORM_MINGW32 |
71 | if (n) *n++ = sep; | 70 | if (n) *n++ = sep; |
72 | #else | 71 | #else |
73 | if (n) *n++ = ':'; | 72 | if (n) *n++ = ':'; |
74 | #endif | 73 | #endif |
75 | if (ex) { | ||
76 | *PATHp = n; | ||
77 | return p; | ||
78 | } | ||
79 | #if ENABLE_PLATFORM_MINGW32 | 74 | #if ENABLE_PLATFORM_MINGW32 |
80 | else if ((w=add_win32_extension(p))) { | 75 | if ((w=add_win32_extension(p))) { |
81 | *PATHp = n; | 76 | *PATHp = n; |
82 | free(p); | 77 | free(p); |
83 | return w; | 78 | return w; |
84 | } | 79 | } |
85 | #endif | 80 | #endif |
81 | ex = file_is_executable(p); | ||
82 | if (ex) { | ||
83 | *PATHp = n; | ||
84 | return p; | ||
85 | } | ||
86 | free(p); | 86 | free(p); |
87 | p = n; | 87 | p = n; |
88 | } /* on loop exit p == NULL */ | 88 | } /* on loop exit p == NULL */ |