diff options
Diffstat (limited to 'src/Erebos/Storage/Internal.hs')
-rw-r--r-- | src/Erebos/Storage/Internal.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Erebos/Storage/Internal.hs b/src/Erebos/Storage/Internal.hs index 47d344f..a61e705 100644 --- a/src/Erebos/Storage/Internal.hs +++ b/src/Erebos/Storage/Internal.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP #-} + module Erebos.Storage.Internal where import Codec.Compression.Zlib @@ -229,7 +231,14 @@ openLockFile :: FilePath -> IO Handle openLockFile path = do createDirectoryIfMissing True (takeDirectory path) fd <- retry 10 $ +#if MIN_VERSION_unix(2,8,0) + openFd path WriteOnly defaultFileFlags + { creat = Just $ unionFileModes ownerReadMode ownerWriteMode + , exclusive = True + } +#else openFd path WriteOnly (Just $ unionFileModes ownerReadMode ownerWriteMode) (defaultFileFlags { exclusive = True }) +#endif fdToHandle fd where retry :: Int -> IO a -> IO a |