aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 46c4f1675..c9122b291 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8899,9 +8899,13 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c
8899# else 8899# else
8900 if (APPLET_IS_NOEXEC(applet_no)) { 8900 if (APPLET_IS_NOEXEC(applet_no)) {
8901# endif 8901# endif
8902#if ENABLE_PLATFORM_MINGW32 && !defined(_UCRT)
8903 /* If building for UCRT move this up into shellexec() to
8904 * work around a bug. */
8902 clearenv(); 8905 clearenv();
8903 while (*envp) 8906 while (*envp)
8904 putenv(*envp++); 8907 putenv(*envp++);
8908#endif
8905 popredir(/*drop:*/ 1); 8909 popredir(/*drop:*/ 1);
8906 run_noexec_applet_and_exit(applet_no, cmd, argv); 8910 run_noexec_applet_and_exit(applet_no, cmd, argv);
8907 } 8911 }
@@ -8971,6 +8975,14 @@ static void shellexec(char *prog, char **argv, const char *path, int idx)
8971 int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */ 8975 int applet_no = -1; /* used only by FEATURE_SH_STANDALONE */
8972 8976
8973 envp = listvars(VEXPORT, VUNSET, /*strlist:*/ NULL, /*end:*/ NULL); 8977 envp = listvars(VEXPORT, VUNSET, /*strlist:*/ NULL, /*end:*/ NULL);
8978#if ENABLE_PLATFORM_MINGW32 && defined(_UCRT)
8979 /* Avoid UCRT bug by updating parent's environment and passing a
8980 * NULL environment pointer to execve(). */
8981 clearenv();
8982 while (*envp)
8983 putenv(*envp++);
8984 envp = NULL;
8985#endif
8974#if !ENABLE_PLATFORM_MINGW32 8986#if !ENABLE_PLATFORM_MINGW32
8975 if (strchr(prog, '/') != NULL 8987 if (strchr(prog, '/') != NULL
8976#else 8988#else