Commit 05e608a0c7

Andrew Kelley <superjoe30@gmail.com>
2018-10-09 18:58:13
stage1 os: workaround for macos not having environ variable
1 parent e29a3b1
Changed files (1)
src
src/os.cpp
@@ -71,6 +71,12 @@ static clock_serv_t cclock;
 #include <errno.h>
 #include <time.h>
 
+// Apple doesn't provide the environ global variable
+#if defined(__APPLE__) && !defined(environ)
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif 
+
 #if defined(ZIG_OS_POSIX)
 static void populate_termination(Termination *term, int status) {
     if (WIFEXITED(status)) {