diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-04-18 09:16:04 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-04-18 09:16:04 +0000 |
commit | bceaffc7cc1c484a1bb353e1d8ac42d2e8e57f69 (patch) | |
tree | e7d01ff4fb93be1625225ce0d8963d076bd5e3a3 /lib/System | |
parent | 6523803203b9cc81386a76cce413db8907796e92 (diff) | |
download | external_llvm-bceaffc7cc1c484a1bb353e1d8ac42d2e8e57f69.zip external_llvm-bceaffc7cc1c484a1bb353e1d8ac42d2e8e57f69.tar.gz external_llvm-bceaffc7cc1c484a1bb353e1d8ac42d2e8e57f69.tar.bz2 |
Properly inherit the environment on darwin where environ is not available for shared libraries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r-- | lib/System/Unix/Program.inc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 7fdf387..b7b4e9e 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -34,6 +34,8 @@ #include <spawn.h> #if !defined(__APPLE__) extern char **environ; +#else +#include <crt_externs.h> // _NSGetEnviron #endif #endif @@ -202,8 +204,11 @@ Program::Execute(const Path &path, const char **args, const char **envp, } } + if (!envp) #if !defined(__APPLE__) - if (!envp) envp = (const char**)environ; + envp = (const char**)environ; +#else + envp = (const char**)*_NSGetEnviron(); // environ is missing in dylibs. #endif pid_t PID; |