From e14c853d9a8f2ba9949e11b32ccab56b940ba57f Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Sat, 23 Jun 2018 16:07:02 +0800 Subject: [PATCH] gspawn: Declare environ Function do_posix_spawn uses environ, but gspawn.c doesn't declare it. Since there is no system header declaring this global variable, this causes compilation error on FreeBSD. Code added in this commit is copied from genviron.c. --- glib/gspawn.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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