aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-11-04 12:27:45 +0000
committerRon Yorston <rmy@pobox.com>2021-11-04 12:27:45 +0000
commit9e12622a8706a0d23a3ff8792773e73b0d6108b4 (patch)
treefdbbfc2f59676cf9e3ce346f977adacb80711314 /win32
parent42a3e960faaff1458c7ca3c138d1847b1a104089 (diff)
downloadbusybox-w32-9e12622a8706a0d23a3ff8792773e73b0d6108b4.tar.gz
busybox-w32-9e12622a8706a0d23a3ff8792773e73b0d6108b4.tar.bz2
busybox-w32-9e12622a8706a0d23a3ff8792773e73b0d6108b4.zip
win32: move UCRT hack to process.c
Only apply the UCRT hack if we're about to call spawnve() with a non-NULL environment pointer. Add the pid of the process to the name of the environment variable to provide greater assurance that the environment will be changed.
Diffstat (limited to 'win32')
-rw-r--r--win32/process.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/win32/process.c b/win32/process.c
index 812e259f4..137cb6a39 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -268,6 +268,14 @@ 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
271 errno = 0; 279 errno = 0;
272 ret = spawnve(mode, new_path ? new_path : path, new_argv, env); 280 ret = spawnve(mode, new_path ? new_path : path, new_argv, env);
273 281