From ae15c5abe0bb2d8bd5fd3502721288bcb1a85d59 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 13 Jun 2021 15:52:34 -0400 Subject: spawn: Allow NULL envp for the current environment --- spawn.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'spawn.c') diff --git a/spawn.c b/spawn.c index 4879e12..82beca5 100644 --- a/spawn.c +++ b/spawn.c @@ -217,6 +217,11 @@ fail: } pid_t bfs_spawn(const char *exe, const struct bfs_spawn *ctx, char **argv, char **envp) { + extern char **environ; + if (!envp) { + envp = environ; + } + // Use a pipe to report errors from the child int pipefd[2]; if (pipe_cloexec(pipefd) != 0) { -- cgit v1.2.3