mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 15:46:37 +08:00
fix(linux): cast stat.Bsize to int64 for accurate calculations
This commit is contained in:
@@ -258,8 +258,8 @@ func StatFilesystem(path string) (int64, int64) {
|
|||||||
if err := syscall.Statfs(absPath, &stat); err != nil {
|
if err := syscall.Statfs(absPath, &stat); err != nil {
|
||||||
return 0, 0
|
return 0, 0
|
||||||
}
|
}
|
||||||
total := multiplyUint64Int64(stat.Blocks, stat.Bsize)
|
total := multiplyUint64Int64(stat.Blocks, int64(stat.Bsize))
|
||||||
free := multiplyUint64Int64(stat.Bavail, stat.Bsize)
|
free := multiplyUint64Int64(stat.Bavail, int64(stat.Bsize))
|
||||||
used := max(total-free, 0)
|
used := max(total-free, 0)
|
||||||
return total, used
|
return total, used
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user