diff options
author | Ron Yorston <rmy@pobox.com> | 2021-11-01 08:25:05 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-11-01 08:25:05 +0000 |
commit | 0acd7c7984e680f2e352ed43556b2f4cc8da2fbb (patch) | |
tree | 71b9e7b770361d9374bb86548cb5d28a37fb022c | |
parent | 5b48ca53be57bc907ed8dd00635914556b4472e4 (diff) | |
download | busybox-w32-0acd7c7984e680f2e352ed43556b2f4cc8da2fbb.tar.gz busybox-w32-0acd7c7984e680f2e352ed43556b2f4cc8da2fbb.tar.bz2 busybox-w32-0acd7c7984e680f2e352ed43556b2f4cc8da2fbb.zip |
win32: rename mingw_spawn_1
The name of the function mingw_spawn_1() wasn't particularly
meaningful. Remove its envp argument (as all of its current callers
pass a NULL pointer) and rename it mingw_spawnvp() to better reflect
what it does.
The path search it performs isn't the standard one: it has features
specific to busybox-w32.
-rw-r--r-- | win32/process.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/win32/process.c b/win32/process.c index d5f386a1b..812e259f4 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -340,31 +340,31 @@ mingw_spawn_interpreter(int mode, const char *prog, char *const *argv, | |||
340 | } | 340 | } |
341 | 341 | ||
342 | static intptr_t | 342 | static intptr_t |
343 | mingw_spawn_1(int mode, const char *cmd, char *const *argv, char *const *envp) | 343 | mingw_spawnvp(int mode, const char *cmd, char *const *argv) |
344 | { | 344 | { |
345 | char *prog; | 345 | char *prog; |
346 | intptr_t ret; | 346 | intptr_t ret; |
347 | 347 | ||
348 | #if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE | 348 | #if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE |
349 | if (find_applet_by_name(cmd) >= 0) | 349 | if (find_applet_by_name(cmd) >= 0) |
350 | return mingw_spawn_applet(mode, argv, envp); | 350 | return mingw_spawn_applet(mode, argv, NULL); |
351 | else | 351 | else |
352 | #endif | 352 | #endif |
353 | if (has_path(cmd)) { | 353 | if (has_path(cmd)) { |
354 | char *path = alloc_system_drive(cmd); | 354 | char *path = alloc_system_drive(cmd); |
355 | add_win32_extension(path); | 355 | add_win32_extension(path); |
356 | ret = mingw_spawn_interpreter(mode, path, argv, envp, 0); | 356 | ret = mingw_spawn_interpreter(mode, path, argv, NULL, 0); |
357 | free(path); | 357 | free(path); |
358 | #if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE | 358 | #if ENABLE_FEATURE_PREFER_APPLETS || ENABLE_FEATURE_SH_STANDALONE |
359 | if (ret == -1 && unix_path(cmd) && | 359 | if (ret == -1 && unix_path(cmd) && |
360 | find_applet_by_name(bb_basename(cmd)) >= 0) { | 360 | find_applet_by_name(bb_basename(cmd)) >= 0) { |
361 | return mingw_spawn_applet(mode, argv, envp); | 361 | return mingw_spawn_applet(mode, argv, NULL); |
362 | } | 362 | } |
363 | #endif | 363 | #endif |
364 | return ret; | 364 | return ret; |
365 | } | 365 | } |
366 | else if ((prog=find_first_executable(cmd)) != NULL) { | 366 | else if ((prog=find_first_executable(cmd)) != NULL) { |
367 | ret = mingw_spawn_interpreter(mode, prog, argv, envp, 0); | 367 | ret = mingw_spawn_interpreter(mode, prog, argv, NULL, 0); |
368 | free(prog); | 368 | free(prog); |
369 | return ret; | 369 | return ret; |
370 | } | 370 | } |
@@ -378,7 +378,7 @@ mingw_spawn_pid(int mode, char **argv) | |||
378 | { | 378 | { |
379 | intptr_t ret; | 379 | intptr_t ret; |
380 | 380 | ||
381 | ret = mingw_spawn_1(mode, argv[0], (char *const *)argv, NULL); | 381 | ret = mingw_spawnvp(mode, argv[0], (char *const *)argv); |
382 | 382 | ||
383 | return ret == -1 ? (pid_t)-1 : (pid_t)GetProcessId((HANDLE)ret); | 383 | return ret == -1 ? (pid_t)-1 : (pid_t)GetProcessId((HANDLE)ret); |
384 | } | 384 | } |
@@ -398,13 +398,13 @@ mingw_spawn_detach(char **argv) | |||
398 | intptr_t FAST_FUNC | 398 | intptr_t FAST_FUNC |
399 | mingw_spawn_proc(const char **argv) | 399 | mingw_spawn_proc(const char **argv) |
400 | { | 400 | { |
401 | return mingw_spawn_1(P_NOWAIT, argv[0], (char *const *)argv, NULL); | 401 | return mingw_spawnvp(P_NOWAIT, argv[0], (char *const *)argv); |
402 | } | 402 | } |
403 | 403 | ||
404 | int | 404 | int |
405 | mingw_execvp(const char *cmd, char *const *argv) | 405 | mingw_execvp(const char *cmd, char *const *argv) |
406 | { | 406 | { |
407 | int ret = (int)mingw_spawn_1(P_WAIT, cmd, argv, NULL); | 407 | int ret = (int)mingw_spawnvp(P_WAIT, cmd, argv); |
408 | if (ret != -1 || errno == 0) | 408 | if (ret != -1 || errno == 0) |
409 | exit(ret); | 409 | exit(ret); |
410 | return ret; | 410 | return ret; |