mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
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:
parent
b6c989b801
commit
d025142f52
1 changed files with 2 additions and 2 deletions
|
@ -580,7 +580,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
|
||||||
AutoCloseDir dir = opendir(linksDir.c_str());
|
AutoCloseDir dir = opendir(linksDir.c_str());
|
||||||
if (!dir) throw SysError(format("opening directory `%1%'") % linksDir);
|
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;
|
struct dirent * dirent;
|
||||||
while (errno = 0, dirent = readdir(dir)) {
|
while (errno = 0, dirent = readdir(dir)) {
|
||||||
|
@ -611,7 +611,7 @@ void LocalStore::removeUnusedLinks(const GCState & state)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat(linksDir.c_str(), &st) == -1)
|
if (stat(linksDir.c_str(), &st) == -1)
|
||||||
throw SysError(format("statting `%1%'") % linksDir);
|
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")
|
printMsg(lvlInfo, format("note: currently hard linking saves %.2f MiB")
|
||||||
% ((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0)));
|
% ((unsharedSize - actualSize - overhead) / (1024.0 * 1024.0)));
|
||||||
|
|
Loading…
Reference in a new issue