Ticket #1279: User.hsc.patch

File User.hsc.patch, 854 bytes (added by guest, 7 years ago)
  • User.hsc

    old new  
    332332getAllUserEntries :: IO [UserEntry] 
    333333#ifdef HAVE_GETPWENT 
    334334getAllUserEntries =  
    335     withMVar lock $ \_ -> worker [] 
     335    withMVar lock $ \_ -> do c_setpwent 
     336                             l <- worker [] 
     337                             c_endpwent 
     338                             return l 
    336339    where worker accum =  
    337340              do resetErrno 
    338341                 ppw <- throwErrnoIfNullAndError "getAllUserEntries" $  
     
    344347 
    345348foreign import ccall unsafe "getpwent" 
    346349  c_getpwent :: IO (Ptr CPasswd) 
     350foreign import ccall unsafe "setpwent" 
     351  c_setpwent :: IO () 
     352foreign import ccall unsafe "endpwent" 
     353  c_endpwent :: IO () 
    347354#else 
    348355getAllUserEntries = error "System.Posix.User.getAllUserEntries: not supported" 
    349356#endif