aboutsummaryrefslogtreecommitdiff
path: root/win32/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/process.c')
-rw-r--r--win32/process.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/win32/process.c b/win32/process.c
index d4ab07ad8..5978226f0 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -345,27 +345,32 @@ mingw_spawnvp(int mode, const char *cmd, char *const *argv)
345{ 345{
346 char *prog; 346 char *prog;
347 intptr_t ret; 347 intptr_t ret;
348#if !defined(_UCRT)
349 char *const *envp = environ;
350#else
351 char *const *envp = NULL;
352#endif
348 353
349#if ENABLE_FEATURE_PREFER_APPLETS && NUM_APPLETS > 1 354#if ENABLE_FEATURE_PREFER_APPLETS && NUM_APPLETS > 1
350 if (find_applet_by_name(cmd) >= 0) 355 if (find_applet_by_name(cmd) >= 0)
351 return mingw_spawn_applet(mode, argv, NULL); 356 return mingw_spawn_applet(mode, argv, envp);
352 else 357 else
353#endif 358#endif
354 if (has_path(cmd)) { 359 if (has_path(cmd)) {
355 char *path = alloc_system_drive(cmd); 360 char *path = alloc_system_drive(cmd);
356 add_win32_extension(path); 361 add_win32_extension(path);
357 ret = mingw_spawn_interpreter(mode, path, argv, NULL, 0); 362 ret = mingw_spawn_interpreter(mode, path, argv, envp, 0);
358 free(path); 363 free(path);
359#if ENABLE_FEATURE_PREFER_APPLETS && NUM_APPLETS > 1 364#if ENABLE_FEATURE_PREFER_APPLETS && NUM_APPLETS > 1
360 if (ret == -1 && unix_path(cmd) && 365 if (ret == -1 && unix_path(cmd) &&
361 find_applet_by_name(bb_basename(cmd)) >= 0) { 366 find_applet_by_name(bb_basename(cmd)) >= 0) {
362 return mingw_spawn_applet(mode, argv, NULL); 367 return mingw_spawn_applet(mode, argv, envp);
363 } 368 }
364#endif 369#endif
365 return ret; 370 return ret;
366 } 371 }
367 else if ((prog=find_first_executable(cmd)) != NULL) { 372 else if ((prog=find_first_executable(cmd)) != NULL) {
368 ret = mingw_spawn_interpreter(mode, prog, argv, NULL, 0); 373 ret = mingw_spawn_interpreter(mode, prog, argv, envp, 0);
369 free(prog); 374 free(prog);
370 return ret; 375 return ret;
371 } 376 }