Skip to content

Commit

Permalink
Adjust openFd usage to support unix-2.8.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Jul 26, 2023
1 parent 100d1ca commit ddaac94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/LockFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ddaac94

Please sign in to comment.