From 5db88aa16bdda504f4bc00fadcd2e27d55c2f63e Mon Sep 17 00:00:00 2001 From: Herbert Valerio Riedel Date: Sat, 30 Jan 2016 16:58:31 +0100 Subject: Change `drainOutput`'s `tcdrain(3)` into a `safe` FFI call Since the primary purpose of `tcdrain(3)` is to block it makes much more sense to use a `safe` FFI import. --- System/Posix/Terminal/Common.hsc | 2 +- changelog.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc index 4825b10..68ce321 100644 --- a/System/Posix/Terminal/Common.hsc +++ b/System/Posix/Terminal/Common.hsc @@ -421,7 +421,7 @@ drainOutput :: Fd -> IO () #if HAVE_TCDRAIN drainOutput (Fd fd) = throwErrnoIfMinus1_ "drainOutput" (c_tcdrain fd) -foreign import capi unsafe "termios.h tcdrain" +foreign import capi safe "termios.h tcdrain" c_tcdrain :: CInt -> IO CInt #else {-# WARNING drainOutput diff --git a/changelog.md b/changelog.md index c6d6b69..1105cba 100644 --- a/changelog.md +++ b/changelog.md @@ -8,8 +8,10 @@ * Don't assume existence of `ctermid(3)`/`tcdrain(3)` + * Change `drainOutput`'s `tcdrain(3)` into a `safe` FFI call + * Turn build error into compile warnings for exotic `struct stat` - configurations (GHC #8859). + configurations (GHC #8859) * Improve detection of `fdatasync(2)` (GHC #11137) -- cgit v1.2.3