1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Description: Fix crash caused by filename encoding issue.
https://github.com/kolmodin/hinotify/issues/5
Author: Joey Hess <joeyh@debian.org>
--- haskell-hinotify-0.3.5.orig/src/System/INotify.hsc
+++ haskell-hinotify-0.3.5/src/System/INotify.hsc
@@ -41,7 +41,7 @@ import Control.Exception as E (bracket,
import Data.Maybe
import Data.Map (Map)
import qualified Data.Map as Map
-import Foreign.C
+import Foreign.C hiding (withCString)
import Foreign.Marshal hiding (void)
import Foreign.Ptr
import Foreign.Storable
@@ -55,6 +55,8 @@ import GHC.Handle
import System.Posix.Internals
#endif
import System.Posix.Files
+import GHC.IO.Encoding (getFileSystemEncoding)
+import GHC.Foreign (withCString)
import System.INotify.Masks
@@ -194,7 +196,8 @@ addWatch inotify@(INotify _ fd em _ _) m
Nothing
(Just fp)
let mask = joinMasks (map eventVarietyToMask masks)
- wd <- withCString fp $ \fp_c ->
+ enc <- getFileSystemEncoding
+ wd <- withCString enc fp $ \fp_c ->
throwErrnoIfMinus1 "addWatch" $
c_inotify_add_watch (fromIntegral fd) fp_c mask
let event = \e -> do
|