From 93c88c266eacd80a7f2a1754778167390c287b18 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 11 Mar 2020 15:25:25 -0400 Subject: 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. --- libraries/base/System/Posix/Internals.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libraries/base/System') 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" -- cgit v1.2.1