1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

Properly inherit the environment on darwin where environ is not available for shared libraries.

llvm-svn: 101710
This commit is contained in:
Benjamin Kramer 2010-04-18 09:16:04 +00:00
parent 152b2bc046
commit 6f6354213f

View File

@ -34,6 +34,8 @@
#include <spawn.h> #include <spawn.h>
#if !defined(__APPLE__) #if !defined(__APPLE__)
extern char **environ; extern char **environ;
#else
#include <crt_externs.h> // _NSGetEnviron
#endif #endif
#endif #endif
@ -202,8 +204,11 @@ Program::Execute(const Path &path, const char **args, const char **envp,
} }
} }
if (!envp)
#if !defined(__APPLE__) #if !defined(__APPLE__)
if (!envp) envp = (const char**)environ; envp = (const char**)environ;
#else
envp = (const char**)*_NSGetEnviron(); // environ is missing in dylibs.
#endif #endif
pid_t PID; pid_t PID;