Skip to content

Commit f76875d

Browse files
rednebBodigrim
authored andcommitted
make the foreign imports of dlopen & dlclose safe
1 parent 64a5f87 commit f76875d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

System/Posix/DynamicLinker/Prim.hsc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ data RTLDFlags
8686
deriving (Show, Read)
8787

8888
#if defined(HAVE_DLFCN_H)
89-
foreign import capi unsafe "dlfcn.h dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
89+
foreign import capi safe "dlfcn.h dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
9090
foreign import capi unsafe "dlfcn.h dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
9191
foreign import capi unsafe "dlfcn.h dlerror" c_dlerror :: IO CString
92-
foreign import capi unsafe "dlfcn.h dlclose" c_dlclose :: (Ptr ()) -> IO CInt
92+
foreign import capi safe "dlfcn.h dlclose" c_dlclose :: (Ptr ()) -> IO CInt
9393
#else
94-
foreign import ccall unsafe "dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
94+
foreign import ccall safe "dlopen" c_dlopen :: CString -> CInt -> IO (Ptr ())
9595
foreign import ccall unsafe "dlsym" c_dlsym :: Ptr () -> CString -> IO (FunPtr a)
9696
foreign import ccall unsafe "dlerror" c_dlerror :: IO CString
97-
foreign import ccall unsafe "dlclose" c_dlclose :: (Ptr ()) -> IO CInt
97+
foreign import ccall safe "dlclose" c_dlclose :: (Ptr ()) -> IO CInt
9898
#endif // HAVE_DLFCN_H
9999

100100
packRTLDFlags :: [RTLDFlags] -> CInt

0 commit comments

Comments
 (0)