diff options
Diffstat (limited to 'System/Posix/Temp.hsc')
-rw-r--r-- | System/Posix/Temp.hsc | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/System/Posix/Temp.hsc b/System/Posix/Temp.hsc index 2d7ca52..473364c 100644 --- a/System/Posix/Temp.hsc +++ b/System/Posix/Temp.hsc @@ -1,6 +1,6 @@ #if __GLASGOW_HASKELL__ >= 709 {-# LANGUAGE Safe #-} -#elif __GLASGOW_HASKELL__ >= 703 +#else {-# LANGUAGE Trustworthy #-} #endif ----------------------------------------------------------------------------- @@ -33,10 +33,8 @@ import System.Posix.IO import System.Posix.Types import System.Posix.Internals (withFilePath, peekFilePath) -#if defined(__GLASGOW_HASKELL__) foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" c_mkstemp :: CString -> IO CInt -#endif -- | Make a unique filename and open it for reading\/writing. The returned -- 'FilePath' is the (possibly relative) path of the created file, which is @@ -48,17 +46,11 @@ foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" mkstemp :: String -> IO (FilePath, Handle) mkstemp template' = do let template = template' ++ "XXXXXX" -#if defined(__GLASGOW_HASKELL__) withFilePath template $ \ ptr -> do fd <- throwErrnoIfMinus1 "mkstemp" (c_mkstemp ptr) name <- peekFilePath ptr h <- fdToHandle (Fd fd) return (name, h) -#else - name <- mktemp template - h <- openFile name ReadWriteMode - return (name, h) -#endif #if HAVE_MKSTEMPS foreign import ccall unsafe "HsUnix.h __hscore_mkstemps" @@ -114,7 +106,7 @@ mkdtemp template' = do return name #endif -#if !defined(__GLASGOW_HASKELL__) || !HAVE_MKDTEMP +#if !HAVE_MKDTEMP foreign import ccall unsafe "mktemp" c_mktemp :: CString -> IO CString |