mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +00:00
storage-monitor: statvfs arithmetic bug fixed (#13234)
This commit is contained in:
committed by
GitHub
parent
545de88c47
commit
d99e2e4bea
@@ -118,7 +118,10 @@ impl StorageMonitorService {
|
|||||||
/// Returns free space in MB, or error if statvfs failed.
|
/// Returns free space in MB, or error if statvfs failed.
|
||||||
fn free_space(path: &Path) -> Result<u64, Error> {
|
fn free_space(path: &Path) -> Result<u64, Error> {
|
||||||
statvfs(path)
|
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)
|
.map_err(Error::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user