unix 2.2.0.0 → 2.3.0.0
raw patch · 5 files changed
+23/−11 lines, 5 files
Files
- System/Posix/IO.hsc +1/−1
- System/Posix/Process.hsc +2/−2
- System/Posix/Signals.hs +4/−1
- System/Posix/User.hsc +15/−6
- unix.cabal +1/−1
System/Posix/IO.hsc view
@@ -12,7 +12,7 @@ -- POSIX IO support. These types and functions correspond to the unix -- functions open(2), close(2), etc. For more portable functions -- which are more like fopen(3) and friends from stdio.h, see--- 'System.IO'.+-- "System.IO". -- -----------------------------------------------------------------------------
System/Posix/Process.hsc view
@@ -9,8 +9,8 @@ -- Stability : provisional -- Portability : non-portable (requires POSIX) ----- POSIX process support. See also the "System.Cmd" and "System.Process"--- modules.+-- POSIX process support. See also the System.Cmd and System.Process+-- modules in the process package. -- -----------------------------------------------------------------------------
System/Posix/Signals.hs view
@@ -97,10 +97,11 @@ import System.IO.Unsafe import System.Posix.Types import System.Posix.Internals+import Control.Concurrent (withMVar) #ifdef __GLASGOW_HASKELL__ #include "Signals.h"-import GHC.Conc ( ensureIOManagerIsRunning )+import GHC.Conc ( ensureIOManagerIsRunning, signalHandlerLock ) #endif -- -----------------------------------------------------------------------------@@ -322,6 +323,8 @@ Just (SignalSet x) -> withForeignPtr x $ install' where install' mask = + -- prevent race with the IO manager thread, see #1922+ withMVar signalHandlerLock $ \_ -> alloca $ \p_sp -> do rc <- case handler of
System/Posix/User.hsc view
@@ -55,6 +55,10 @@ #ifdef HAVE_GETPWENT import Control.Exception #endif+#ifdef HAVE_GETGRNAM_R+import Control.Monad+import System.IO.Error+#endif -- ----------------------------------------------------------------------------- -- user environemnt@@ -187,13 +191,18 @@ getGroupEntryForName name = do allocaBytes (#const sizeof(struct group)) $ \pgr -> allocaBytes grBufSize $ \pbuf ->- alloca $ \ ppgr -> - withCString name $ \ pstr -> do+ alloca $ \ ppgr ->+ withCString name $ \ pstr -> do throwErrorIfNonZero_ "getGroupEntryForName" $- c_getgrnam_r pstr pgr pbuf (fromIntegral grBufSize) ppgr- throwErrnoIfNull "getGroupEntryForName" $- peekElemOff ppgr 0- unpackGroupEntry pgr+ c_getgrnam_r pstr pgr pbuf (fromIntegral grBufSize) ppgr+ r <- peekElemOff ppgr 0+ when (r == nullPtr) $+ ioError $ flip ioeSetErrorString "no group name"+ $ mkIOError doesNotExistErrorType+ "getGroupEntryForName"+ Nothing+ (Just name)+ unpackGroupEntry pgr foreign import ccall unsafe "getgrnam_r" c_getgrnam_r :: CString -> Ptr CGroup -> CString
unix.cabal view
@@ -1,5 +1,5 @@ name: unix-version: 2.2.0.0+version: 2.3.0.0 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org