From ddaac94395ac50e3d3cd34c133dda4a8e5a3fd6c Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Wed, 26 Jul 2023 13:28:32 +0800 Subject: [PATCH] Adjust openFd usage to support unix-2.8.0.0 --- src/LockFile.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/LockFile.hs b/src/LockFile.hs index bf36daf..f55c965 100644 --- a/src/LockFile.hs +++ b/src/LockFile.hs @@ -23,6 +23,12 @@ lockFile filename' = do exitFailure #else flip catchIOError (\e -> hPutStrLn stderr ("arbtt [Error]: Could not aquire lock for " ++ filename ++"!") >> exitFailure) $ do - fd <- openFd (filename ++ ".lck") WriteOnly (Just 0o644) defaultFileFlags + let fileMode = Just 0o644 + fd <- openFd (filename ++ ".lck") WriteOnly +#if MIN_VERSION_unix(2,8,0) + (defaultFileFlags { creat = fileMode }) +#else + fileMode defaultFileFlags +#endif setLock fd (WriteLock, AbsoluteSeek, 0, 0) #endif