Skip to content

Commit

Permalink
cmd/utils: add workaround for FreeBSD statfs quirk (ethereum#22310)
Browse files Browse the repository at this point in the history
Make geth build on FreeBSD, fixes ethereum#22309.
  • Loading branch information
gballet authored Feb 15, 2021
1 parent 7d1b711 commit 08c878a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/utils/diskusage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 08c878a

Please sign in to comment.