git.iko.soy/typeable/entropy
on main help sign in
Merge pull request #69 from athas/unix28

Support unix-2.8.

commit2aca9efaa8548d6345431af7fa00689ab791165a authorThomas M. DuBuisson <thomas.dubuisson@gmail.com> dateSun 21 Aug 2022, 19:06 (4 years ago) parentdf05b1a7dec21c
1 file changed+5−1
System/EntropyNix.hs+5−1
System/EntropyNix.hs+5−1
@@ -34,7 +34,7 @@ import Data.ByteString.Internal as B
3434#undef HAVE_RDRAND
3535#endif
3636
37−import System.Posix (openFd, closeFd, fdReadBuf, OpenMode(..), defaultFileFlags, Fd)
37+import System.Posix (openFd, closeFd, fdReadBuf, OpenMode(..), defaultFileFlags, Fd, OpenFileFlags(..))
3838
3939source :: FilePath
4040source = "/dev/urandom"
@@ -75,7 +75,11 @@ openHandle =
7575openRandomFile :: IO Fd
7676openRandomFile = do
7777 evaluate ensurePoolInitialized
78+#if MIN_VERSION_unix(2,8,0)
79+ openFd source ReadOnly defaultFileFlags { creat = Nothing }
80+#else
7881 openFd source ReadOnly Nothing defaultFileFlags
82+#endif
7983
8084-- |Close the `CryptHandle`
8185closeHandle :: CryptHandle -> IO ()