summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-04-18 06:22:26 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-04-18 06:22:26 +0000
commit3fdf58800a6960a6e5aec791c36dfad94f562d7e (patch)
treee4b24daddaac31b6ad44e6f2889a5f594856922b /llvm/lib/System/Unix
parent5acc7d0e17efdcaa304b3ac4b3854b954a99ddc3 (diff)
downloadbcm5719-llvm-3fdf58800a6960a6e5aec791c36dfad94f562d7e.tar.gz
bcm5719-llvm-3fdf58800a6960a6e5aec791c36dfad94f562d7e.zip
Fix linux build. posix_spawn doesn't inherit the environment by default.
llvm-svn: 101701
Diffstat (limited to 'llvm/lib/System/Unix')
-rw-r--r--llvm/lib/System/Unix/Program.inc5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/System/Unix/Program.inc b/llvm/lib/System/Unix/Program.inc
index 44e831ff2d3..476e90b38b2 100644
--- a/llvm/lib/System/Unix/Program.inc
+++ b/llvm/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);
OpenPOWER on IntegriCloud