diff options
author | Ron Yorston <rmy@pobox.com> | 2021-01-23 09:22:00 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-01-23 09:38:50 +0000 |
commit | a19a9c222e3966b445de3259ce83dfff4411a67d (patch) | |
tree | b68ecf4ea3947ba4caef6ffac9aefdc71ff93db4 | |
parent | acdad474b48e3acd7511e7899b85d8ada67c7031 (diff) | |
download | busybox-w32-a19a9c222e3966b445de3259ce83dfff4411a67d.tar.gz busybox-w32-a19a9c222e3966b445de3259ce83dfff4411a67d.tar.bz2 busybox-w32-a19a9c222e3966b445de3259ce83dfff4411a67d.zip |
libbb: reduce changes to find_executable()
Reduce the divergence from upstream in find_executable():
- Reset the path separator after the call to file_is_executable().
Doing it before isn't wrong, but it's different.
- Move the declaration 'char *w;' into a platform-specific block.
-rw-r--r-- | libbb/executable.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libbb/executable.c b/libbb/executable.c index bd3022b13..e20bf89e4 100644 --- a/libbb/executable.c +++ b/libbb/executable.c | |||
@@ -39,9 +39,6 @@ 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 | ||
45 | 42 | ||
46 | p = *PATHp; | 43 | p = *PATHp; |
47 | while (p) { | 44 | while (p) { |
@@ -53,14 +50,16 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) | |||
53 | p[0] ? p : ".", /* handle "::" case */ | 50 | p[0] ? p : ".", /* handle "::" case */ |
54 | filename | 51 | filename |
55 | ); | 52 | ); |
56 | if (n) *n++ = PATH_SEP; | ||
57 | #if ENABLE_PLATFORM_MINGW32 | 53 | #if ENABLE_PLATFORM_MINGW32 |
58 | w = alloc_system_drive(p); | 54 | { |
59 | add_win32_extension(w); | 55 | char *w = alloc_system_drive(p); |
60 | free(p); | 56 | add_win32_extension(w); |
61 | p = w; | 57 | free(p); |
58 | p = w; | ||
59 | } | ||
62 | #endif | 60 | #endif |
63 | ex = file_is_executable(p); | 61 | ex = file_is_executable(p); |
62 | if (n) *n++ = PATH_SEP; | ||
64 | if (ex) { | 63 | if (ex) { |
65 | *PATHp = n; | 64 | *PATHp = n; |
66 | return p; | 65 | return p; |