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 | 351d457e2e4f503b1bc38486cecc9465f17998ef (patch) | |
| tree | e7d01ff4fb93be1625225ce0d8963d076bd5e3a3 /lib/System/Unix/Program.inc | |
| parent | 83793e429e53fd3cb1ba8e95391130a3986058b3 (diff) | |
| download | external_llvm-351d457e2e4f503b1bc38486cecc9465f17998ef.zip external_llvm-351d457e2e4f503b1bc38486cecc9465f17998ef.tar.gz external_llvm-351d457e2e4f503b1bc38486cecc9465f17998ef.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/Unix/Program.inc')
| -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; |
