Fix free space measurement for OSX

This commit is contained in:
Jeremy Lakeman 2016-07-05 10:11:49 +09:30
parent 9f4f56b663
commit c56b733391

View File

@ -172,7 +172,17 @@ static uint64_t store_get_free_space()
WARNF_perror("statvfs(%s)", store_path);
return UINT64_MAX;
}
return stats.f_bsize * stats.f_bfree;
uint64_t space = stats.f_frsize * stats.f_bavail;
if (IF_DEBUG(rhizome)){
double pretty = space;
const char *suffix = " KMGT";
while(pretty >= 1024 && suffix[1]){
pretty = pretty / 1024;
suffix++;
}
DEBUGF(rhizome, "Found %.2f%cB of free space", pretty, *suffix);
}
return space;
#else
return UINT64_MAX;
#endif