git-annex/Utility/OpenFd.hs
Joey Hess 68c9b08faf
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.
2023-08-01 18:41:27 -04:00

25 lines
598 B
Haskell

{- openFd wrapper to support old versions of unix package.
-
- Copyright 2023 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-tabs #-}
module Utility.OpenFd (
openFdWithMode,
) where
import System.Posix.IO.ByteString
import System.Posix.Types
import System.FilePath.ByteString (RawFilePath)
openFdWithMode :: RawFilePath -> OpenMode -> Maybe FileMode -> OpenFileFlags -> IO Fd
#if MIN_VERSION_unix(2,8,0)
openFdWithMode f openmode filemode flags =
openFd f openmode (flags { creat = filemode })
#else
openFdWithMode = openFd
#endif