errnoToIOError is not necessarily thread-safe
The following strerror() call is problematic on some platforms:
foreign import ccall unsafe "string.h" strerror :: Errno -> IO (Ptr CChar)
errnoToIOError :: String -- ^ the location where the error occurred
-> Errno -- ^ the error number
-> Maybe Handle -- ^ optional handle associated with the error
-> Maybe String -- ^ optional filename associated with the error
-> IOError
errnoToIOError loc errno maybeHdl maybeName = unsafePerformIO $ do
str <- strerror errno >>= peekCString
return (IOError maybeHdl errType loc str (Just errno') maybeName)
The strerror() function need not be thread-safe.
On some systems, strerror() returns NULL if the error number is
unknown. (...) C99 and POSIX.1-2008 require the return value
to be non-NULL.
- https://man7.org/linux/man-pages/man3/strerror.3p.html
- https://man7.org/linux/man-pages/man3/strerror.3.html
Version: base-4.19.0.0
Module: Foreign.C.Error