Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 5749760

Browse files
storage-monitor: statvfs arithmetic bug fixed (#13234)
1 parent 09de7b4 commit 5749760

File tree

1 file changed

+4
-1
lines changed
  • client/storage-monitor/src

1 file changed

+4
-1
lines changed

client/storage-monitor/src/lib.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ impl StorageMonitorService {
118118
/// Returns free space in MB, or error if statvfs failed.
119119
fn free_space(path: &Path) -> Result<u64, Error> {
120120
statvfs(path)
121-
.map(|stats| stats.blocks_available() * stats.block_size() / 1_000_000)
121+
.map(|stats| {
122+
u64::from(stats.blocks_available()).saturating_mul(u64::from(stats.block_size())) /
123+
1_000_000
124+
})
122125
.map_err(Error::from)
123126
}
124127

0 commit comments

Comments
 (0)