diff options
author | Jude Taylor <me@jude.bio> | 2017-01-06T19·30-0800 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-01-16T22·52+0100 |
commit | c0d55f918379f46b87e43457745895439a85555c (patch) | |
tree | 4e3c4d951ddc4dc8f613f8e106cd69ee817c7e73 /src/nix-build | |
parent | 8079ab87a2a7cd288a35334517da7a808af8e1e0 (diff) |
assign environ to a temp variable to ensure liveness
Diffstat (limited to 'src/nix-build')
-rwxr-xr-x | src/nix-build/nix-build.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc index 2bb12c9b278f..3eb2d2c0b7a9 100755 --- a/src/nix-build/nix-build.cc +++ b/src/nix-build/nix-build.cc @@ -446,10 +446,13 @@ int main(int argc, char ** argv) ? Strings{"bash", "--rcfile", rcfile} : Strings{"bash", rcfile}; - environ = stringsToCharPtrs(envStrs).data(); + auto envPtrs = stringsToCharPtrs(envStrs); - execvp(getEnv("NIX_BUILD_SHELL", "bash").c_str(), - stringsToCharPtrs(args).data()); + environ = envPtrs.data(); + + auto argPtrs = stringsToCharPtrs(args); + + execvp(getEnv("NIX_BUILD_SHELL", "bash").c_str(), argPtrs.data()); throw SysError("executing shell"); } |