fix build with unix-2.8.0

Changed the parameters to openFd. So needed to add a small wrapper
library to keep supporting older versions as well.
This commit is contained in:
Joey Hess 2023-08-01 18:41:27 -04:00
parent 4ef16f53ed
commit 68c9b08faf
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
12 changed files with 51 additions and 16 deletions

View file

@ -12,6 +12,7 @@ module Git.LockFile where
import Common
#ifndef mingw32_HOST_OS
import Utility.OpenFd
import System.Posix.Types
import System.Posix.IO
#else
@ -51,7 +52,7 @@ openLock' :: FilePath -> IO LockHandle
openLock' lck = do
#ifndef mingw32_HOST_OS
-- On unix, git simply uses O_EXCL
h <- openFd lck ReadWrite (Just 0O666)
h <- openFdWithMode (toRawFilePath lck) ReadWrite (Just 0O666)
(defaultFileFlags { exclusive = True })
setFdOption h CloseOnExec True
#else