diff options
author | Ting-Wei Lan <lantw@src.gnome.org> | 2018-06-23 16:07:02 +0800 |
---|---|---|
committer | Ting-Wei Lan <lantw@src.gnome.org> | 2018-06-23 16:11:19 +0800 |
commit | e14c853d9a8f2ba9949e11b32ccab56b940ba57f (patch) | |
tree | 5226f12a5f135e1ce14fc903c4b70d553b6598c6 | |
parent | 0f77dc847bb2e32c8df5491f9bac552b84e490e7 (diff) | |
download | glib-wip/lantw/gspawn-declare-environ.tar.gz |
gspawn: Declare environwip/lantw/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.
-rw-r--r-- | glib/gspawn.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 <dirent.h> #include <spawn.h> +#ifdef HAVE_CRT_EXTERNS_H +#include <crt_externs.h> /* for _NSGetEnviron */ +#endif + #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #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 |