diff options
author | 2002-12-26 17:52:35 +0000 | |
---|---|---|
committer | 2002-12-26 17:52:35 +0000 | |
commit | 6681d4c6e43b2e38455660dcaf169fa1dc0bd539 (patch) | |
tree | d2e2219fc2f3235477bc6d0d055f9c788428b996 /System/Posix/User.hsc | |
parent | f46082b665d7748bdec2981e21d332ee90a7c1cd (diff) |
[project @ 2002-12-26 17:52:35 by wolfgang]
Mac OS X doesn't have the sysconfig constants _SC_GETPW_R_SIZE_MAX and _SC_GETGR_R_SIZE_MAX, so add a configure check
Diffstat (limited to 'System/Posix/User.hsc')
-rw-r--r-- | System/Posix/User.hsc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc index 1201164..d05e928 100644 --- a/System/Posix/User.hsc +++ b/System/Posix/User.hsc @@ -171,11 +171,14 @@ foreign import ccall unsafe "getgrnam_r" getGroupEntryForName = error "System.Posix.User.getGroupEntryForName: not supported" #endif -#if (defined(HAVE_GETGRGID_R) || defined(HAVE_GETGRNAM_R)) \ - && defined(HAVE_SYSCONF) +#if defined(HAVE_GETGRGID_R) || defined(HAVE_GETGRNAM_R) grBufSize :: Int +#if defined(HAVE_SYSCONF) && defined(HAVE_SC_GETGR_R_SIZE_MAX) grBufSize = fromIntegral $ unsafePerformIO $ c_sysconf (#const _SC_GETGR_R_SIZE_MAX) +#else +grBufSize = 1024 -- just assume some value +#endif #endif unpackGroupEntry :: Ptr CGroup -> IO GroupEntry @@ -237,11 +240,14 @@ foreign import ccall unsafe "getpwnam_r" getUserEntryForName = error "System.Posix.User.getUserEntryForName: not supported" #endif -#if (defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWNAM_R)) \ - && defined(HAVE_SYSCONF) +#if defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWNAM_R) pwBufSize :: Int +#if defined(HAVE_SYSCONF) && defined(HAVE_SC_GETPW_R_SIZE_MAX) pwBufSize = fromIntegral $ unsafePerformIO $ c_sysconf (#const _SC_GETPW_R_SIZE_MAX) +#else +pwBufSize = 1024 +#endif #endif #ifdef HAVE_SYSCONF |