Handle amount of disk space saved by hard linking being negative

Fixes bogus messages like "currently hard linking saves 17592186044416.00 MiB".
This commit is contained in:
volth 2020-10-12 16:06:38 +00:00 committed by GitHub
parent 20d2140e45
commit eee18f88dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -683,7 +683,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
struct stat st;
if (stat(linksDir.c_str(), &st) == -1)
throw SysError("statting '%1%'", linksDir);
auto overhead = st.st_blocks * 512ULL;
int64_t overhead = st.st_blocks * 512ULL;
printInfo("note: currently hard linking saves %.2f MiB",
((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0)));