mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-08 01:01:34 +00:00
cmd/utils: add workaround for FreeBSD statfs quirk (#22310)
Make geth build on FreeBSD, fixes #22309.
This commit is contained in:
parent
7d1b711c7d
commit
08c878acd2
1 changed files with 8 additions and 1 deletions
|
|
@ -31,5 +31,12 @@ func getFreeDiskSpace(path string) (uint64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Available blocks * size per block = available space in bytes
|
// Available blocks * size per block = available space in bytes
|
||||||
return stat.Bavail * uint64(stat.Bsize), nil
|
var bavail = stat.Bavail
|
||||||
|
if stat.Bavail < 0 {
|
||||||
|
// FreeBSD can have a negative number of blocks available
|
||||||
|
// because of the grace limit.
|
||||||
|
bavail = 0
|
||||||
|
}
|
||||||
|
//nolint:unconvert
|
||||||
|
return uint64(bavail) * uint64(stat.Bsize), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue