[llvm-commits] [llvm] r101710 - /llvm/trunk/lib/System/Unix/Program.inc
Benjamin Kramer
benny.kra at googlemail.com
Sun Apr 18 02:16:04 PDT 2010
Author: d0k
Date: Sun Apr 18 04:16:04 2010
New Revision: 101710
URL: http://llvm.org/viewvc/llvm-project?rev=101710&view=rev
Log:
Properly inherit the environment on darwin where environ is not available for shared libraries.
Modified:
llvm/trunk/lib/System/Unix/Program.inc
Modified: llvm/trunk/lib/System/Unix/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=101710&r1=101709&r2=101710&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Program.inc (original)
+++ llvm/trunk/lib/System/Unix/Program.inc Sun Apr 18 04:16:04 2010
@@ -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 @@
}
}
+ 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;
More information about the llvm-commits
mailing list