From 9581d23964c7efad6f8e74e754e36c1ad292cf45 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 14 Apr 2023 18:36:29 +0100 Subject: win32: fix incorrect path search in spawnvp Commit 26ba73098e (win32: search PATH for missing Unix-style executables) rearranged the code of mingw_spawnvp(). As a result commands with a relative or absolute path could be incorrectly searched for on PATH. (GitHub issue #310) --- win32/process.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/win32/process.c b/win32/process.c index 1ee576055..65c65b0d0 100644 --- a/win32/process.c +++ b/win32/process.c @@ -368,9 +368,7 @@ mingw_spawnvp(int mode, const char *cmd, char *const *argv) } if (unix_path(cmd)) cmd = bb_basename(cmd); - } - - if ((path = find_first_executable(cmd)) != NULL) { + } else if ((path = find_first_executable(cmd)) != NULL) { ret = mingw_spawn_interpreter(mode, path, argv, NULL, 0); free(path); return ret; -- cgit v1.2.3-55-g6feb