diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2021-06-13 15:52:34 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2021-06-13 15:52:34 -0400 |
commit | ae15c5abe0bb2d8bd5fd3502721288bcb1a85d59 (patch) | |
tree | 6820851fba0f52ff6be9e96bc0480e328a3bb65d /spawn.c | |
parent | 78e968dd789ca8d1cac8da3715352184bca2a188 (diff) | |
download | bfs-ae15c5abe0bb2d8bd5fd3502721288bcb1a85d59.tar.xz |
spawn: Allow NULL envp for the current environment
Diffstat (limited to 'spawn.c')
-rw-r--r-- | spawn.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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) { |