summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Utility/DiskFree.hs2
-rw-r--r--Utility/libdiskfree.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/Utility/DiskFree.hs b/Utility/DiskFree.hs
index 8d07afaf2..ff7070562 100644
--- a/Utility/DiskFree.hs
+++ b/Utility/DiskFree.hs
@@ -18,7 +18,7 @@ import Foreign.C.Error
foreign import ccall unsafe "libdiskfree.h diskfree" c_diskfree
:: CString -> IO CULLong
-getDiskFree :: String -> IO (Maybe Integer)
+getDiskFree :: FilePath -> IO (Maybe Integer)
getDiskFree path = withFilePath path $ \c_path -> do
free <- c_diskfree c_path
ifM (safeErrno <$> getErrno)
diff --git a/Utility/libdiskfree.c b/Utility/libdiskfree.c
index 54e8c0894..a37cb7571 100644
--- a/Utility/libdiskfree.c
+++ b/Utility/libdiskfree.c
@@ -58,10 +58,10 @@ unsigned long long int diskfree(const char *path) {
unsigned long long int available, blocksize;
struct STATSTRUCT buf;
- if (STATCALL(path, &buf) != 0) {
+ if (STATCALL(path, &buf) != 0)
return 0; /* errno is set */
- }
- errno = 0;
+ else
+ errno = 0;
available = buf.f_bavail;
blocksize = buf.f_bsize;