aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-04-14 18:36:29 +0100
committerRon Yorston <rmy@pobox.com>2023-04-14 18:45:07 +0100
commit9581d23964c7efad6f8e74e754e36c1ad292cf45 (patch)
tree3e4d235ad41fb2addff93257ec955bab43ce1e3e
parentd9f2ea8628452f787e02dd0e496af612a2e94578 (diff)
downloadbusybox-w32-9581d23964c7efad6f8e74e754e36c1ad292cf45.tar.gz
busybox-w32-9581d23964c7efad6f8e74e754e36c1ad292cf45.tar.bz2
busybox-w32-9581d23964c7efad6f8e74e754e36c1ad292cf45.zip
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)
-rw-r--r--win32/process.c4
1 files changed, 1 insertions, 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)
368 } 368 }
369 if (unix_path(cmd)) 369 if (unix_path(cmd))
370 cmd = bb_basename(cmd); 370 cmd = bb_basename(cmd);
371 } 371 } else if ((path = find_first_executable(cmd)) != NULL) {
372
373 if ((path = find_first_executable(cmd)) != NULL) {
374 ret = mingw_spawn_interpreter(mode, path, argv, NULL, 0); 372 ret = mingw_spawn_interpreter(mode, path, argv, NULL, 0);
375 free(path); 373 free(path);
376 return ret; 374 return ret;