cmd/utils: add workaround for FreeBSD statfs quirk (#22310)

Make geth build on FreeBSD, fixes #22309.
revert-23120-drop-eth-65
Guillaume Ballet 4 years ago committed by GitHub
parent 7d1b711c7d
commit 08c878acd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      cmd/utils/diskusage.go

@ -31,5 +31,12 @@ func getFreeDiskSpace(path string) (uint64, error) {
}
// 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…
Cancel
Save