diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2024-02-19 21:11:45 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2024-02-19 21:11:45 +0100 |
commit | d4fda80fb4efd88a58a31c084437ec39e14f9f1e (patch) | |
tree | 2b710919d231976f504ef474fd7a140104425d1a | |
parent | 2107684b6fded1b00dd2c4c84a6ff5926a76347d (diff) |
Fix compatibility with unix-2.8
-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 |