68c9b08faf
Changed the parameters to openFd. So needed to add a small wrapper library to keep supporting older versions as well.
25 lines
598 B
Haskell
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
|