Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Kumpera <kumpera@gmail.com>2015-10-09 22:54:48 +0300
committerRodrigo Kumpera <kumpera@gmail.com>2015-10-09 22:55:03 +0300
commit5e10b3057dd40e1612ef41957e40d9c8999abc52 (patch)
tree1852718c7300107ee095f764641c6697517f0465
parent0421c0cff36b33a58c16930d61227b74633c1e99 (diff)
[Apple] Disable environment access on Apple platforms that are not OSX.
The two known ways to access the environment variables are no longer allowed Apple. Until something blessed by them is found, we'll provide no way to list all the envvars of the current process.
-rw-r--r--eglib/src/gspawn.c9
-rw-r--r--mono/io-layer/processes.c9
-rw-r--r--mono/metadata/icall.c7
3 files changed, 20 insertions, 5 deletions
diff --git a/eglib/src/gspawn.c b/eglib/src/gspawn.c
index 4d0bf9e8eca..01639be101f 100644
--- a/eglib/src/gspawn.c
+++ b/eglib/src/gspawn.c
@@ -74,13 +74,18 @@
#define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
#define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
-#if defined(__APPLE__) && !defined (__arm__) && !defined (__aarch64__)
+#if defined(__APPLE__)
+#if defined (TARGET_OSX)
/* Apple defines this in crt_externs.h but doesn't provide that header for
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
* in fact exist on all implementations (so far)
*/
-gchar ***_NSGetEnviron();
+gchar ***_NSGetEnviron(void);
#define environ (*_NSGetEnviron())
+#else
+static char *mono_environ[1] = { NULL };
+#define environ mono_environ
+#endif /* defined (TARGET_OSX) */
#elif defined(_MSC_VER)
/* MS defines this in stdlib.h */
#else
diff --git a/mono/io-layer/processes.c b/mono/io-layer/processes.c
index df101ae76a4..94938f53704 100644
--- a/mono/io-layer/processes.c
+++ b/mono/io-layer/processes.c
@@ -96,14 +96,19 @@
#include <mono/utils/mono-proclib.h>
/* The process' environment strings */
-#if defined(__APPLE__) && !defined (__arm__) && !defined (__aarch64__)
+#if defined(__APPLE__)
+#if defined (TARGET_OSX)
/* Apple defines this in crt_externs.h but doesn't provide that header for
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
* in fact exist on all implementations (so far)
*/
-char ***_NSGetEnviron(void);
+gchar ***_NSGetEnviron(void);
#define environ (*_NSGetEnviron())
#else
+static char *mono_environ[1] = { NULL };
+#define environ mono_environ
+#endif /* defined (TARGET_OSX) */
+#else
extern char **environ;
#endif
diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c
index e47f9588171..e937e437c04 100644
--- a/mono/metadata/icall.c
+++ b/mono/metadata/icall.c
@@ -5846,7 +5846,8 @@ ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
*/
#ifndef _MSC_VER
#ifndef __MINGW32_VERSION
-#if defined(__APPLE__) && !defined (__arm__) && !defined (__aarch64__)
+#if defined(__APPLE__)
+#if defined (TARGET_OSX)
/* Apple defines this in crt_externs.h but doesn't provide that header for
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
* in fact exist on all implementations (so far)
@@ -5854,6 +5855,10 @@ ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
gchar ***_NSGetEnviron(void);
#define environ (*_NSGetEnviron())
#else
+static char *mono_environ[1] = { NULL };
+#define environ mono_environ
+#endif /* defined (TARGET_OSX) */
+#else
extern
char **environ;
#endif