From 12799d0fc7dcff0dc95640b1efad0637ad011144 Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sun, 31 Jan 2016 16:54:04 +0100 Subject: Have Autoconf test for _NSGetEnviron presence --- System/Posix/Env.hsc | 6 ++---- System/Posix/Env/ByteString.hsc | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'System') diff --git a/System/Posix/Env.hsc b/System/Posix/Env.hsc index 6412bae..7d5f04c 100644 --- a/System/Posix/Env.hsc +++ b/System/Posix/Env.hsc @@ -78,9 +78,8 @@ getEnvironmentPrim = do mapM peekFilePath arr getCEnviron :: IO (Ptr CString) - -#if darwin_HOST_OS --- You should not access _environ directly on Darwin in a bundle/shared library. +#if HAVE__NSGETENVIRON +-- You should not access @char **environ@ directly on Darwin in a bundle/shared library. -- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html getCEnviron = nsGetEnviron >>= peek @@ -88,7 +87,6 @@ foreign import ccall unsafe "_NSGetEnviron" nsGetEnviron :: IO (Ptr (Ptr CString)) #else getCEnviron = peek c_environ_p - foreign import ccall unsafe "&environ" c_environ_p :: Ptr (Ptr CString) #endif diff --git a/System/Posix/Env/ByteString.hsc b/System/Posix/Env/ByteString.hsc index 57b03aa..c6c374c 100644 --- a/System/Posix/Env/ByteString.hsc +++ b/System/Posix/Env/ByteString.hsc @@ -69,8 +69,8 @@ getEnvironmentPrim = do mapM B.packCString arr getCEnviron :: IO (Ptr CString) -#if darwin_HOST_OS --- You should not access _environ directly on Darwin in a bundle/shared library. +#if HAVE__NSGETENVIRON +-- You should not access @char **environ@ directly on Darwin in a bundle/shared library. -- See #2458 and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man7/environ.7.html getCEnviron = nsGetEnviron >>= peek -- cgit v1.2.3