[commit: packages/unix] master: Change `drainOutput`'s `tcdrain(3)` into a `safe` FFI call (5db88aa)

git at git.haskell.org git at git.haskell.org
Tue Apr 19 21:37:29 UTC 2016


Repository : ssh://git@git.haskell.org/unix

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5db88aa16bdda504f4bc00fadcd2e27d55c2f63e/unix

>---------------------------------------------------------------

commit 5db88aa16bdda504f4bc00fadcd2e27d55c2f63e
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Jan 30 16:58:31 2016 +0100

    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.


>---------------------------------------------------------------

5db88aa16bdda504f4bc00fadcd2e27d55c2f63e
 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)
 



More information about the ghc-commits mailing list