From d4fda80fb4efd88a58a31c084437ec39e14f9f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Mon, 19 Feb 2024 21:11:45 +0100 Subject: Fix compatibility with unix-2.8 --- src/Erebos/Storage/Internal.hs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Erebos') 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 -- cgit v1.2.3