about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-06T01·45-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-08-06T01·45-0400
commitd025142f529731f05868f5397f5617011963c8b4 (patch)
treeee9f9dbc902cde2578ba351326a515da2042ca9b
parentb6c989b80198badf5f694340c07abc282365aaec (diff)
Handle amount of disk space saved by hard linking being negative
Fixes bogus messages like "currently hard linking saves
17592186044416.00 MiB".
-rw-r--r--src/libstore/gc.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc
index 255dc3aa099f..406fce672e3b 100644
--- a/src/libstore/gc.cc
+++ b/src/libstore/gc.cc
@@ -580,7 +580,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
     AutoCloseDir dir = opendir(linksDir.c_str());
     if (!dir) throw SysError(format("opening directory `%1%'") % linksDir);
 
-    unsigned long long actualSize = 0, unsharedSize = 0;
+    long long actualSize = 0, unsharedSize = 0;
 
     struct dirent * dirent;
     while (errno = 0, dirent = readdir(dir)) {
@@ -611,7 +611,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
     struct stat st;
     if (stat(linksDir.c_str(), &st) == -1)
         throw SysError(format("statting `%1%'") % linksDir);
-    unsigned long long overhead = st.st_blocks * 512ULL;
+    long long overhead = st.st_blocks * 512ULL;
 
     printMsg(lvlInfo, format("note: currently hard linking saves %.2f MiB")
         % ((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0)));