diff --git a/System/Fuse.hsc b/System/Fuse.hsc index d412145..acfddce 100644 --- a/System/Fuse.hsc +++ b/System/Fuse.hsc @@ -67,13 +67,14 @@ import Foreign import Foreign.C import Foreign.C.Error import Foreign.Marshal +import Foreign.Marshal.Utils (copyBytes) import System.Environment ( getProgName, getArgs ) import System.IO ( hPutStrLn, stderr, withFile, stdin, stdout, IOMode(..) ) import System.Posix.Types import System.Posix.Files ( accessModes, intersectFileModes, unionFileModes ) import System.Posix.Directory(changeWorkingDirectory) import System.Posix.Process(forkProcess,createSession,exitImmediately) -import System.Posix.IO ( OpenMode(..), OpenFileFlags(..) ) +import System.Posix.IO ( OpenMode(..), OpenFileFlags(..), defaultFileFlags ) import qualified System.Posix.Signals as Signals import GHC.IO.Handle(hDuplicateTo) import System.Exit @@ -601,7 +602,7 @@ withStructFuse pFuseChan pArgs ops handler f = how | (#const O_RDWR) .&. flags == (#const O_RDWR) = ReadWrite | (#const O_WRONLY) .&. flags == (#const O_WRONLY) = WriteOnly | otherwise = ReadOnly - openFileFlags = OpenFileFlags { append = append + openFileFlags = defaultFileFlags { append = append , exclusive = False , noctty = noctty , nonBlock = nonBlock @@ -1162,7 +1163,7 @@ foreign import ccall safe "wrapper" bsToBuf :: Ptr a -> B.ByteString -> Int -> IO () bsToBuf dst bs len = do let l = fromIntegral $ min len $ B.length bs - B.unsafeUseAsCString bs $ \src -> B.memcpy (castPtr dst) (castPtr src) l + B.unsafeUseAsCString bs $ \src -> copyBytes (castPtr dst) (castPtr src) l return () -- Get filehandle