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
