aboutsummaryrefslogtreecommitdiffhomepage
path: root/System/Posix/Directory.hsc
diff options
context:
space:
mode:
authorGravatar Simon Marlow <marlowsd@gmail.com>2011-05-10 11:16:55 +0100
committerGravatar Simon Marlow <marlowsd@gmail.com>2011-05-10 11:16:55 +0100
commitb7b180d23472dca03fb4c809cd86bcd6d3f01ea9 (patch)
tree6e20b00c909d197fb2f762334b260ef15c36475e /System/Posix/Directory.hsc
parentcdf2106d5d09bc54702c3d2f1fa5cbeeb772d70c (diff)
allow some syscalls in System.Posix.Directory to return EINTR (#5184)
Diffstat (limited to 'System/Posix/Directory.hsc')
-rw-r--r--System/Posix/Directory.hsc12
1 files changed, 7 insertions, 5 deletions
diff --git a/System/Posix/Directory.hsc b/System/Posix/Directory.hsc
index 3f676ce..cb357df 100644
--- a/System/Posix/Directory.hsc
+++ b/System/Posix/Directory.hsc
@@ -45,8 +45,10 @@ import Foreign.C
-- @mode@.
createDirectory :: FilePath -> FileMode -> IO ()
createDirectory name mode =
- withCString name $ \s ->
- throwErrnoPathIfMinus1_ "createDirectory" name (c_mkdir s mode)
+ withCString name $ \s ->
+ throwErrnoPathIfMinus1Retry_ "createDirectory" name (c_mkdir s mode)
+ -- POSIX doesn't allow mkdir() to return EINTR, but it does on
+ -- OS X (#5184), so we need the Retry variant here.
foreign import ccall unsafe "mkdir"
c_mkdir :: CString -> CMode -> IO CInt
@@ -58,7 +60,7 @@ newtype DirStream = DirStream (Ptr CDir)
openDirStream :: FilePath -> IO DirStream
openDirStream name =
withCString name $ \s -> do
- dirp <- throwErrnoPathIfNull "openDirStream" name $ c_opendir s
+ dirp <- throwErrnoPathIfNullRetry "openDirStream" name $ c_opendir s
return (DirStream dirp)
foreign import ccall unsafe "__hsunix_opendir"
@@ -115,7 +117,7 @@ foreign import ccall unsafe "rewinddir"
-- the directory stream @dp@.
closeDirStream :: DirStream -> IO ()
closeDirStream (DirStream dirp) = do
- throwErrnoIfMinus1_ "closeDirStream" (c_closedir dirp)
+ throwErrnoIfMinus1Retry_ "closeDirStream" (c_closedir dirp)
foreign import ccall unsafe "closedir"
c_closedir :: Ptr CDir -> IO CInt
@@ -190,7 +192,7 @@ foreign import ccall unsafe "rmdir"
changeWorkingDirectoryFd :: Fd -> IO ()
changeWorkingDirectoryFd (Fd fd) =
- throwErrnoIfMinus1_ "changeWorkingDirectoryFd" (c_fchdir fd)
+ throwErrnoIfMinus1Retry_ "changeWorkingDirectoryFd" (c_fchdir fd)
foreign import ccall unsafe "fchdir"
c_fchdir :: CInt -> IO CInt