diff options
| author | Ron Yorston <rmy@pobox.com> | 2020-08-23 10:16:12 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2020-08-23 10:16:12 +0100 |
| commit | 64ecd10486934c12336dac84c67a1939dce0e096 (patch) | |
| tree | 73e8bc6b07176b84295fd07f19828292a240f693 /libbb/executable.c | |
| parent | d6b557547551dd80a389f361a995a97ef5930a63 (diff) | |
| download | busybox-w32-64ecd10486934c12336dac84c67a1939dce0e096.tar.gz busybox-w32-64ecd10486934c12336dac84c67a1939dce0e096.tar.bz2 busybox-w32-64ecd10486934c12336dac84c67a1939dce0e096.zip | |
win32: code shrink Unix-style path handling
Replace auto_add_system_drive() with alloc_system_drive() which
leaves space for a possible filename extension. This makes it
possible to drop alloc_win32_extension() and auto_win32_extension().
Saves 144 bytes.
Diffstat (limited to 'libbb/executable.c')
| -rw-r--r-- | libbb/executable.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libbb/executable.c b/libbb/executable.c index 0a0769ef3..f549a7aae 100644 --- a/libbb/executable.c +++ b/libbb/executable.c | |||
| @@ -49,20 +49,16 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) | |||
| 49 | 49 | ||
| 50 | n = strchr(p, PATH_SEP); | 50 | n = strchr(p, PATH_SEP); |
| 51 | if (n) *n = '\0'; | 51 | if (n) *n = '\0'; |
| 52 | #if ENABLE_PLATFORM_MINGW32 | ||
| 53 | p = auto_add_system_drive(p); | ||
| 54 | #endif | ||
| 55 | p = concat_path_file( | 52 | p = concat_path_file( |
| 56 | p[0] ? p : ".", /* handle "::" case */ | 53 | p[0] ? p : ".", /* handle "::" case */ |
| 57 | filename | 54 | filename |
| 58 | ); | 55 | ); |
| 59 | if (n) *n++ = PATH_SEP; | 56 | if (n) *n++ = PATH_SEP; |
| 60 | #if ENABLE_PLATFORM_MINGW32 | 57 | #if ENABLE_PLATFORM_MINGW32 |
| 61 | if ((w=alloc_win32_extension(p))) { | 58 | w = alloc_system_drive(p); |
| 62 | free(p); | 59 | add_win32_extension(w); |
| 63 | p = w; | 60 | free(p); |
| 64 | /* following test will succeed */ | 61 | p = w; |
| 65 | } | ||
| 66 | #endif | 62 | #endif |
| 67 | ex = file_is_executable(p); | 63 | ex = file_is_executable(p); |
| 68 | if (ex) { | 64 | if (ex) { |
