Skip to content
Snippets Groups Projects
Commit 3c28bc83 authored by kgardas's avatar kgardas
Browse files

fix getGroupEntryForID/Name on Solaris

This patch fixes getGroupEntryForID and getGroupEntryForName on Solaris
The issue on Solaris is that it defines both required getgrgid_r
and getgrnam_r functions as CPP macros which depending on configuration
are mapped to real function implementations with different names.
The issue is solved by using C API calling convention instead of platform
C ABI calling convention.
parent 30248d77
No related branches found
No related tags found
No related merge requests found
#ifdef __GLASGOW_HASKELL__
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE Trustworthy, CApiFFI #-}
#endif
-----------------------------------------------------------------------------
-- |
......@@ -207,7 +207,7 @@ getGroupEntryForID gid =
doubleAllocWhileERANGE "getGroupEntryForID" "group" grBufSize unpackGroupEntry $
c_getgrgid_r gid pgr
foreign import ccall unsafe "getgrgid_r"
foreign import capi unsafe "HsUnix.h getgrgid_r"
c_getgrgid_r :: CGid -> Ptr CGroup -> CString
-> CSize -> Ptr (Ptr CGroup) -> IO CInt
#else
......@@ -226,7 +226,7 @@ getGroupEntryForName name =
doubleAllocWhileERANGE "getGroupEntryForName" "group" grBufSize unpackGroupEntry $
c_getgrnam_r pstr pgr
foreign import ccall unsafe "getgrnam_r"
foreign import capi unsafe "HsUnix.h getgrnam_r"
c_getgrnam_r :: CString -> Ptr CGroup -> CString
-> CSize -> Ptr (Ptr CGroup) -> IO CInt
#else
......
* Fix `getGroupEntryForID/getGroupEntryForName' on Solaris. Solaris uses
CPP macros for required getgrgid_r and getgrnam_r functions definition
so the fix is to change from C ABI calling convention to C API calling
convention
## 2.7.0.1 *Mar 2014*
* Bundled with GHC 7.8.1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment