lanzatool: don't open file to read metadata
This commit is contained in:
parent
1c0438a003
commit
b592d92744
|
@ -212,14 +212,13 @@ fn image_base(pe: &PE) -> u64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn file_size(path: impl AsRef<Path>) -> Result<u64> {
|
fn file_size(path: impl AsRef<Path>) -> Result<u64> {
|
||||||
Ok(fs::File::open(&path)
|
Ok(fs::metadata(&path)
|
||||||
.with_context(|| {
|
.with_context(|| {
|
||||||
format!(
|
format!(
|
||||||
"Failed to read file to calculate its size: {:?}",
|
"Failed to read file metadata to calculate its size: {:?}",
|
||||||
path.as_ref()
|
path.as_ref()
|
||||||
)
|
)
|
||||||
})?
|
})?
|
||||||
.metadata()?
|
|
||||||
.size())
|
.size())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue