aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar stolz <unknown>2004-11-12 13:22:56 +0000
committerGravatar stolz <unknown>2004-11-12 13:22:56 +0000
commitdfa057af04178f247222c8b7caf12c834b81fec2 (patch)
tree54f905a6bafc458c846c8cc87fec5fac322ca6c9
parent2eaaf04f858a0762b9d7e027308ee38e336a52f0 (diff)
[project @ 2004-11-12 13:22:56 by stolz]
More getpw*_r result checks
-rw-r--r--System/Posix/User.hsc6
1 files changed, 6 insertions, 0 deletions
diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc
index 7b0db2a..69976a1 100644
--- a/System/Posix/User.hsc
+++ b/System/Posix/User.hsc
@@ -137,6 +137,8 @@ getGroupEntryForID gid = do
alloca $ \ ppgr -> do
throwErrorIfNonZero_ "getGroupEntryForID" $
c_getgrgid_r gid pgr pbuf (fromIntegral grBufSize) ppgr
+ throwErrnoIfNull "getGroupEntryForID" $
+ peekElemOff ppgr 0
unpackGroupEntry pgr
@@ -157,6 +159,8 @@ getGroupEntryForName name = do
withCString name $ \ pstr -> do
throwErrorIfNonZero_ "getGroupEntryForName" $
c_getgrnam_r pstr pgr pbuf (fromIntegral grBufSize) ppgr
+ throwErrnoIfNull "getGroupEntryForName" $
+ peekElemOff ppgr 0
unpackGroupEntry pgr
foreign import ccall unsafe "getgrnam_r"
@@ -214,6 +218,8 @@ getUserEntryForID uid = do
alloca $ \ pppw -> do
throwErrorIfNonZero_ "getUserEntryForID" $
c_getpwuid_r uid ppw pbuf (fromIntegral pwBufSize) pppw
+ throwErrnoIfNull "getUserEntryForID" $
+ peekElemOff pppw 0
unpackUserEntry ppw
foreign import ccall unsafe "getpwuid_r"