diff options
| -rw-r--r-- | shell/ash.c | 10 | ||||
| -rw-r--r-- | win32/process.c | 8 |
2 files changed, 10 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c index ad1e5ba7e..6d7066a1b 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -8898,9 +8898,11 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) const char *cmd, char **argv, c | |||
| 8898 | # else | 8898 | # else |
| 8899 | if (APPLET_IS_NOEXEC(applet_no)) { | 8899 | if (APPLET_IS_NOEXEC(applet_no)) { |
| 8900 | # endif | 8900 | # endif |
| 8901 | #if !defined(_UCRT) | ||
| 8901 | clearenv(); | 8902 | clearenv(); |
| 8902 | while (*envp) | 8903 | while (*envp) |
| 8903 | putenv(*envp++); | 8904 | putenv(*envp++); |
| 8905 | #endif | ||
| 8904 | popredir(/*drop:*/ 1); | 8906 | popredir(/*drop:*/ 1); |
| 8905 | run_noexec_applet_and_exit(applet_no, cmd, argv); | 8907 | run_noexec_applet_and_exit(applet_no, cmd, argv); |
| 8906 | } | 8908 | } |
| @@ -8973,6 +8975,14 @@ static void shellexec(char *prog, char **argv, const char *path, int idx) | |||
| 8973 | #if !ENABLE_PLATFORM_MINGW32 | 8975 | #if !ENABLE_PLATFORM_MINGW32 |
| 8974 | if (strchr(prog, '/') != NULL | 8976 | if (strchr(prog, '/') != NULL |
| 8975 | #else | 8977 | #else |
| 8978 | #if 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 | ||
| 8976 | if (has_path(prog) | 8986 | if (has_path(prog) |
| 8977 | #endif | 8987 | #endif |
| 8978 | #if ENABLE_FEATURE_SH_STANDALONE | 8988 | #if ENABLE_FEATURE_SH_STANDALONE |
diff --git a/win32/process.c b/win32/process.c index 137cb6a39..812e259f4 100644 --- a/win32/process.c +++ b/win32/process.c | |||
| @@ -268,14 +268,6 @@ spawnveq(int mode, const char *path, char *const *argv, char *const *env) | |||
| 268 | new_path = xasprintf("%s.", path); | 268 | new_path = xasprintf("%s.", path); |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | #if defined(_UCRT) | ||
| 272 | if (env) { | ||
| 273 | char buffer[64]; | ||
| 274 | |||
| 275 | sprintf(buffer, "BB_HELLO_%d", getpid()); | ||
| 276 | SetEnvironmentVariable(buffer, "1"); | ||
| 277 | } | ||
| 278 | #endif | ||
| 279 | errno = 0; | 271 | errno = 0; |
| 280 | ret = spawnve(mode, new_path ? new_path : path, new_argv, env); | 272 | ret = spawnve(mode, new_path ? new_path : path, new_argv, env); |
| 281 | 273 | ||
