mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
cmd/utils/diskusage: fix unreachable bavail check
This commit is contained in:
parent
bd91810462
commit
f8928d6304
2 changed files with 2 additions and 5 deletions
|
|
@ -33,12 +33,10 @@ func getFreeDiskSpace(path string) (uint64, error) {
|
||||||
|
|
||||||
// Available blocks * size per block = available space in bytes
|
// Available blocks * size per block = available space in bytes
|
||||||
var bavail = stat.Bavail
|
var bavail = stat.Bavail
|
||||||
// nolint:staticcheck
|
if int64(stat.Bavail) < 0 {
|
||||||
if stat.Bavail < 0 {
|
|
||||||
// FreeBSD can have a negative number of blocks available
|
// FreeBSD can have a negative number of blocks available
|
||||||
// because of the grace limit.
|
// because of the grace limit.
|
||||||
bavail = 0
|
bavail = 0
|
||||||
}
|
}
|
||||||
//nolint:unconvert
|
return bavail * uint64(stat.Bsize), nil
|
||||||
return uint64(bavail) * uint64(stat.Bsize), nil
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,5 @@ func getFreeDiskSpace(path string) (uint64, error) {
|
||||||
// because of the grace limit.
|
// because of the grace limit.
|
||||||
bavail = 0
|
bavail = 0
|
||||||
}
|
}
|
||||||
//nolint:unconvert
|
|
||||||
return uint64(bavail) * uint64(stat.F_bsize), nil
|
return uint64(bavail) * uint64(stat.F_bsize), nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue