From 5b48ca53be57bc907ed8dd00635914556b4472e4 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 28 Oct 2021 14:24:24 +0100 Subject: 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. --- shell/ash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'shell') 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) new->nprocs = jp == NULL ? 0 : jp->nprocs; sprintf(buf, "%p", new->hMapFile); argv[2] = buf; - ret = spawnve(P_NOWAIT, bb_busybox_exec_path, (char *const *)argv, environ); + ret = spawnve(P_NOWAIT, bb_busybox_exec_path, (char *const *)argv, NULL); CloseHandle(new->hMapFile); UnmapViewOfFile(new); if (ret == -1) { -- cgit v1.2.3-55-g6feb