diff --git a/glib/gspawn.c b/glib/gspawn.c index 4fe60a584..38b84337e 100644 --- a/glib/gspawn.c +++ b/glib/gspawn.c @@ -32,6 +32,10 @@ #include #include +#ifdef HAVE_CRT_EXTERNS_H +#include /* for _NSGetEnviron */ +#endif + #ifdef HAVE_SYS_SELECT_H #include #endif /* HAVE_SYS_SELECT_H */ @@ -71,6 +75,12 @@ #endif /* __GLIBC__ */ #endif /* HAVE_POSIX_SPAWN */ +#ifdef HAVE__NSGETENVIRON +#define environ (*_NSGetEnviron()) +#else +extern char **environ; +#endif + /** * SECTION:spawn * @Short_description: process launching