mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-04-07 11:08:36 +00:00
Fix free space measurement for OSX
This commit is contained in:
parent
9f4f56b663
commit
c56b733391
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user