aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-30 16:58:31 +0100
committerGravatar Herbert Valerio Riedel <hvr@gnu.org>2016-01-30 16:58:31 +0100
commit5db88aa16bdda504f4bc00fadcd2e27d55c2f63e (patch)
tree7825613d61fbc85eb03d959b5789d5874ecdc853
parentd17b03d4d4525103f1995441045eae4c2c73355d (diff)
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.
-rw-r--r--System/Posix/Terminal/Common.hsc2
-rw-r--r--changelog.md4
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)