diff options
author | Ben Gamari <ben@smart-cactus.org> | 2020-03-11 15:25:25 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-03-14 05:31:42 -0400 |
commit | 93c88c266eacd80a7f2a1754778167390c287b18 (patch) | |
tree | d726c9cc757b61a18d14d3539e5d958c3b599ae0 /libraries/base/System | |
parent | 73133a3b601b76c46098fb8ad3c76de5fe04c9b2 (diff) | |
download | haskell-93c88c266eacd80a7f2a1754778167390c287b18.tar.gz |
base: Make `open` calls interruptible
As noted in #17912, `open` system calls were `safe` rather than
`interruptible`. Consequently, the program could not be interrupted with
SIGINT if stuck in a slow open operation. Fix this by marking
`c_safe_open` as interruptible.
Diffstat (limited to 'libraries/base/System')
-rw-r--r-- | libraries/base/System/Posix/Internals.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libraries/base/System/Posix/Internals.hs b/libraries/base/System/Posix/Internals.hs index 15a02ff1e1..ea8ddf2173 100644 --- a/libraries/base/System/Posix/Internals.hs +++ b/libraries/base/System/Posix/Internals.hs @@ -1,4 +1,5 @@ {-# LANGUAGE Trustworthy #-} +{-# LANGUAGE InterruptibleFFI #-} {-# LANGUAGE CPP, NoImplicitPrelude, CApiFFI #-} {-# OPTIONS_HADDOCK not-home #-} @@ -355,7 +356,8 @@ type CFilePath = CWString foreign import ccall unsafe "HsBase.h __hscore_open" c_open :: CFilePath -> CInt -> CMode -> IO CInt -foreign import ccall safe "HsBase.h __hscore_open" +-- e.g. use `interruptible` rather than `safe` due to #17912. +foreign import ccall interruptible "HsBase.h __hscore_open" c_safe_open :: CFilePath -> CInt -> CMode -> IO CInt foreign import ccall unsafe "HsBase.h __hscore_fstat" |