aboutsummaryrefslogtreecommitdiff
path: root/lib/System
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2010-04-18 07:07:48 +0000
committerNick Lewycky <nicholas@mxc.ca>2010-04-18 07:07:48 +0000
commit6523803203b9cc81386a76cce413db8907796e92 (patch)
tree053d9159621dd6463aa6c4638eeee3a85363e644 /lib/System
parent1a3eb953ccd3fd2d2d2f3e1e5522882852f07bb2 (diff)
This is horrible. Split the difference, and declare 'environ' on all non-Darwin
platforms to unbreak the darwin and linux builds. The BSD folks should feel free to change the #if, if this breaks them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101703 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Unix/Program.inc7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index 2f3616e73a..7fdf3872dd 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -32,6 +32,9 @@
#endif
#ifdef HAVE_POSIX_SPAWN
#include <spawn.h>
+#if !defined(__APPLE__)
+ extern char **environ;
+#endif
#endif
namespace llvm {
@@ -199,6 +202,10 @@ Program::Execute(const Path &path, const char **args, const char **envp,
}
}
+#if !defined(__APPLE__)
+ if (!envp) envp = (const char**)environ;
+#endif
+
pid_t PID;
int Err = posix_spawn(&PID, path.c_str(), &FileActions,
/*attrp*/0, (char**)args, (char**)envp);