From 5ba93edef629974b7728e637ddffd904d2d4ebd5 Mon Sep 17 00:00:00 2001 From: MaYuming Date: Wed, 4 Sep 2019 08:37:34 -0400 Subject: [PATCH] build: fix ios build error `_NSGetEnviron()` is not available on that platform. PR-URL: https://github.com/libuv/libuv/pull/2449 Reviewed-By: Ben Noordhuis Signed-off-by: MaYuming --- src/unix/core.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/unix/core.c b/src/unix/core.c index f4b94e30c..ee52b1f41 100644 --- a/src/unix/core.c +++ b/src/unix/core.c @@ -49,17 +49,22 @@ # include #endif -#ifdef __APPLE__ -# include -# include /* _NSGetExecutablePath */ +#if defined(__APPLE__) # include # if defined(O_CLOEXEC) # define UV__O_CLOEXEC O_CLOEXEC -# endif +# endif /* defined(O_CLOEXEC) */ +# endif /* defined(__APPLE__) */ + + +#if defined(__APPLE__) && !TARGET_OS_IPHONE +# include +# include /* _NSGetExecutablePath */ # define environ (*_NSGetEnviron()) -#else +#else /* defined(__APPLE__) && !TARGET_OS_IPHONE */ extern char** environ; -#endif +#endif /* !(defined(__APPLE__) && !TARGET_OS_IPHONE) */ + #if defined(__DragonFly__) || \ defined(__FreeBSD__) || \