diff options
author | Ron Yorston <rmy@pobox.com> | 2018-02-28 16:48:33 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-02-28 16:48:33 +0000 |
commit | b0a565de930df8dc4fd8f00cbfe3a585391cb05a (patch) | |
tree | 4098345cacecbe4e8f5e6dc72810e61101072ccc /win32 | |
parent | decda04ffdbe4803e3d346b3784403b68faba82e (diff) | |
download | busybox-w32-b0a565de930df8dc4fd8f00cbfe3a585391cb05a.tar.gz busybox-w32-b0a565de930df8dc4fd8f00cbfe3a585391cb05a.tar.bz2 busybox-w32-b0a565de930df8dc4fd8f00cbfe3a585391cb05a.zip |
win32: don't add extensions to filenames ending with a dot
A filename ending with a dot is a signal to spawnve not to try
adding extensions but to use the name unmodified.
The add_win32_extension function should follow the same rule.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/mingw.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 22e62232d..260bc82d7 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1033,6 +1033,12 @@ int has_exe_suffix(const char *name) | |||
1033 | return has_win_suffix(name, 0); | 1033 | return has_win_suffix(name, 0); |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | int has_exe_suffix_or_dot(const char *name) | ||
1037 | { | ||
1038 | int len = strlen(name); | ||
1039 | return (len > 0 && name[len-1] == '.') || has_win_suffix(name, 0); | ||
1040 | } | ||
1041 | |||
1036 | /* check if path can be made into an executable by adding a suffix; | 1042 | /* check if path can be made into an executable by adding a suffix; |
1037 | * return an allocated string containing the path if it can; | 1043 | * return an allocated string containing the path if it can; |
1038 | * return NULL if not. | 1044 | * return NULL if not. |
@@ -1044,7 +1050,7 @@ char *add_win32_extension(const char *p) | |||
1044 | char *path; | 1050 | char *path; |
1045 | int i, len; | 1051 | int i, len; |
1046 | 1052 | ||
1047 | if (has_exe_suffix(p)) { | 1053 | if (has_exe_suffix_or_dot(p)) { |
1048 | return NULL; | 1054 | return NULL; |
1049 | } | 1055 | } |
1050 | 1056 | ||