From: David Woodhouse Date: Mon, 18 Apr 2022 14:38:57 +0000 (+0100) Subject: Attempt to make posix_spawn() work on OSX X-Git-Tag: v9.00~37 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5f59ad13690d071e4c1d94a670e79a60280d8ead;p=users%2Fdwmw2%2Fopenconnect.git Attempt to make posix_spawn() work on OSX Fixes: #409 Signed-off-by: David Woodhouse --- diff --git a/hpke.c b/hpke.c index 663cab91..005d83b4 100644 --- a/hpke.c +++ b/hpke.c @@ -24,10 +24,6 @@ int handle_external_browser(struct openconnect_info *vpninfo) } #else -#ifdef HAVE_POSIX_SPAWN -#include -#endif - #include #define HPKE_TAG_PUBKEY 1 diff --git a/main.c b/main.c index b31e34de..81c39646 100644 --- a/main.c +++ b/main.c @@ -896,8 +896,8 @@ static BOOL WINAPI console_ctrl_handler(DWORD dwCtrlType) return TRUE; } #endif + #ifdef HAVE_POSIX_SPAWN -#include static int spawn_browser(struct openconnect_info *vpninfo, const char *url, void *cbdata) { vpn_progress(vpninfo, PRG_TRACE, diff --git a/openconnect-internal.h b/openconnect-internal.h index ee007027..fb2ed2dd 100644 --- a/openconnect-internal.h +++ b/openconnect-internal.h @@ -127,6 +127,14 @@ #include #include +#ifdef HAVE_POSIX_SPAWN +#ifdef __APPLE__ +#include +#define environ (*_NSGetEnviron()) +#endif +#include +#endif + /* Equivalent of "/dev/null" on Windows. * See https://stackoverflow.com/a/44163934 */