From: Benjamin Kramer Date: Sun, 18 Apr 2010 09:16:04 +0000 (+0000) Subject: Properly inherit the environment on darwin where environ is not available for shared... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bceaffc7cc1c484a1bb353e1d8ac42d2e8e57f69;p=oota-llvm.git 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 --- diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 7fdf3872dd9..b7b4e9eb469 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -34,6 +34,8 @@ #include #if !defined(__APPLE__) extern char **environ; +#else +#include // _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;