diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2010-04-18 06:22:26 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2010-04-18 06:22:26 +0000 |
commit | b7dfca977849eacd8079a725f61229ba1534e71c (patch) | |
tree | 5da23a3560e43fbe815a681c050aedda082714aa /lib/System | |
parent | 4f098b68a50528b9f53a461ebea670ee935fb556 (diff) | |
download | external_llvm-b7dfca977849eacd8079a725f61229ba1534e71c.zip external_llvm-b7dfca977849eacd8079a725f61229ba1534e71c.tar.gz external_llvm-b7dfca977849eacd8079a725f61229ba1534e71c.tar.bz2 |
Fix linux build. posix_spawn doesn't inherit the environment by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101701 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r-- | lib/System/Unix/Program.inc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 44e831f..476e90b 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -34,6 +34,8 @@ #include <spawn.h> #endif +extern char **environ; + namespace llvm { using namespace sys; @@ -126,7 +128,7 @@ static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) { #ifdef HAVE_POSIX_SPAWN static bool RedirectIO_PS(const Path *Path, int FD, std::string *ErrMsg, - posix_spawn_file_actions_t &FileActions) { + posix_spawn_file_actions_t &FileActions) { if (Path == 0) // Noop return false; std::string File; @@ -200,6 +202,7 @@ Program::Execute(const Path &path, const char **args, const char **envp, } pid_t PID; + if (!envp) envp = (const char**)environ; int Err = posix_spawn(&PID, path.c_str(), &FileActions, /*attrp*/0, (char**)args, (char**)envp); |