aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-10-28 14:24:24 +0100
committerRon Yorston <rmy@pobox.com>2021-10-28 14:24:24 +0100
commit5b48ca53be57bc907ed8dd00635914556b4472e4 (patch)
tree98b7ad2143efaa39608227eb470b8903e19d9b3d /shell
parentd239d2d5273e1620a6146d8f5076f6532e3569b1 (diff)
downloadbusybox-w32-5b48ca53be57bc907ed8dd00635914556b4472e4.tar.gz
busybox-w32-5b48ca53be57bc907ed8dd00635914556b4472e4.tar.bz2
busybox-w32-5b48ca53be57bc907ed8dd00635914556b4472e4.zip
win32: pass NULL to spawnve, not environ
Building busybox-w32 for use with UCRT results in mysterious failures. (GitHub issue #234) These are somehow related to the environment values passed to spawnve. In several places the global environ pointer was being passed to spawnve so the child would inherit its environment from the parent. This can also be achieved by passing a NULL pointer. This prevents the failures in at least some cases and also makes the binary smaller.
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 3e741d7d2..ad1e5ba7e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -16016,7 +16016,7 @@ spawn_forkshell(struct forkshell *fs, struct job *jp, union node *n, int mode)
16016 new->nprocs = jp == NULL ? 0 : jp->nprocs; 16016 new->nprocs = jp == NULL ? 0 : jp->nprocs;
16017 sprintf(buf, "%p", new->hMapFile); 16017 sprintf(buf, "%p", new->hMapFile);
16018 argv[2] = buf; 16018 argv[2] = buf;
16019 ret = spawnve(P_NOWAIT, bb_busybox_exec_path, (char *const *)argv, environ); 16019 ret = spawnve(P_NOWAIT, bb_busybox_exec_path, (char *const *)argv, NULL);
16020 CloseHandle(new->hMapFile); 16020 CloseHandle(new->hMapFile);
16021 UnmapViewOfFile(new); 16021 UnmapViewOfFile(new);
16022 if (ret == -1) { 16022 if (ret == -1) {