forked from cerc-io/plugeth
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
@ -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 New Issue
Block a user