From a19a9c222e3966b445de3259ce83dfff4411a67d Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 23 Jan 2021 09:22:00 +0000 Subject: 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. --- libbb/executable.c | 15 +++++++-------- 1 file 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) * following the rest of the list. */ char *p, *n; -#if ENABLE_PLATFORM_MINGW32 - char *w; -#endif p = *PATHp; while (p) { @@ -53,14 +50,16 @@ char* FAST_FUNC find_executable(const char *filename, char **PATHp) p[0] ? p : ".", /* handle "::" case */ filename ); - if (n) *n++ = PATH_SEP; #if ENABLE_PLATFORM_MINGW32 - w = alloc_system_drive(p); - add_win32_extension(w); - free(p); - p = w; + { + char *w = alloc_system_drive(p); + add_win32_extension(w); + free(p); + p = w; + } #endif ex = file_is_executable(p); + if (n) *n++ = PATH_SEP; if (ex) { *PATHp = n; return p; -- cgit v1.2.3-55-g6feb