Check for a NULL result from realpath; fixes #4113 on non-Windows
[haskell-directory.git] / System / Directory.hs
index 2f3cb25..688a10b 100644 (file)
@@ -685,7 +685,7 @@ canonicalizePath fpath =
 #else
   withCString fpath $ \pInPath ->
   allocaBytes long_path_size $ \pOutPath ->
-    do c_realpath pInPath pOutPath
+    do throwErrnoPathIfNull "canonicalizePath" fpath $ c_realpath pInPath pOutPath
        path <- peekCString pOutPath
 #endif
        return (normalise path)