--- User.hsc.old	2007-04-03 16:35:09.000000000 +0200
+++ User.hsc	2007-04-03 16:33:45.000000000 +0200
@@ -332,7 +332,10 @@
 getAllUserEntries :: IO [UserEntry]
 #ifdef HAVE_GETPWENT
 getAllUserEntries = 
-    withMVar lock $ \_ -> worker []
+    withMVar lock $ \_ -> do c_setpwent
+                             l <- worker []
+                             c_endpwent
+                             return l
     where worker accum = 
               do resetErrno
                  ppw <- throwErrnoIfNullAndError "getAllUserEntries" $ 
@@ -344,6 +347,10 @@
 
 foreign import ccall unsafe "getpwent"
   c_getpwent :: IO (Ptr CPasswd)
+foreign import ccall unsafe "setpwent"
+  c_setpwent :: IO ()
+foreign import ccall unsafe "endpwent"
+  c_endpwent :: IO ()
 #else
 getAllUserEntries = error "System.Posix.User.getAllUserEntries: not supported"
 #endif
