summaryrefslogtreecommitdiff
path: root/native/jni/java-lang/java_lang_VMProcess.c
diff options
context:
space:
mode:
Diffstat (limited to 'native/jni/java-lang/java_lang_VMProcess.c')
-rw-r--r--native/jni/java-lang/java_lang_VMProcess.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/native/jni/java-lang/java_lang_VMProcess.c b/native/jni/java-lang/java_lang_VMProcess.c
index 95921822b..5455c81ee 100644
--- a/native/jni/java-lang/java_lang_VMProcess.c
+++ b/native/jni/java-lang/java_lang_VMProcess.c
@@ -55,8 +55,16 @@ exception statement from your version. */
static char *copy_string(JNIEnv *env, jobject string);
static char *copy_elem(JNIEnv *env, jobject stringArray, jint i);
-/* Some O/S's don't declare this */
+/* Some O/S's don't declare 'environ' */
+#if HAVE_CRT_EXTERNS_H
+/* Darwin does not have a variable named environ
+ but has a function which you can get the environ
+ variable with. */
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
extern char **environ;
+#endif /* HAVE_CRT_EXTERNS_H */
/*
* Internal helper function to copy a String in UTF-8 format.