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

Commit

Permalink
storage-monitor: statvfs arithmetic bug fixed (#13234)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkucharczyk authored and Ross Bulat committed Feb 3, 2023
1 parent 20cd431 commit 9b87e22
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion client/storage-monitor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ impl StorageMonitorService {
/// Returns free space in MB, or error if statvfs failed.
fn free_space(path: &Path) -> Result<u64, Error> {
statvfs(path)
.map(|stats| stats.blocks_available() * stats.block_size() / 1_000_000)
.map(|stats| {
u64::from(stats.blocks_available()).saturating_mul(u64::from(stats.block_size())) /
1_000_000
})
.map_err(Error::from)
}

Expand Down

0 comments on commit 9b87e22

Please sign in to comment.