From 03d7d528fbc352a016395cb5adaf47f2bb625808 Mon Sep 17 00:00:00 2001 From: stolz Date: Fri, 5 Nov 2004 14:59:33 +0000 Subject: [project @ 2004-11-05 14:59:33 by stolz] Fix getpwnam_r-handling: getpwnam_r returns (always?) 0, you have to check result* (pppw[0])! Truss-log from querying first "root", then "" on SunOS 5.9: <- libc:__posix_getpwnam_r() = 0 "root" -> libc:__posix_getpwnam_r(0xff1bf8a8, 0xff1bf460, 0xff1bf490, 0x400) <- libc:__posix_getpwnam_r() = 0 Yes, that's 0 in both cases. (I wasn't even able to elicit an ERANGE btw.) Reported by: Peter Simons --- System/Posix/User.hsc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'System/Posix/User.hsc') diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc index ed5adfb..7b0db2a 100644 --- a/System/Posix/User.hsc +++ b/System/Posix/User.hsc @@ -240,6 +240,8 @@ getUserEntryForName name = do withCString name $ \ pstr -> do throwErrorIfNonZero_ "getUserEntryForName" $ c_getpwnam_r pstr ppw pbuf (fromIntegral pwBufSize) pppw + throwErrnoIfNull "getUserEntryForName" $ + peekElemOff pppw 0 unpackUserEntry ppw foreign import ccall unsafe "getpwnam_r" -- cgit v1.2.3