1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

shred: as we already got the metadata info, use it directly

This commit is contained in:
Sylvestre Ledru 2024-03-16 10:56:15 +01:00
parent f410d0967f
commit 844f077401

View file

@ -474,7 +474,7 @@ fn wipe_file(
let size = match size {
Some(size) => size,
None => get_file_size(path)?,
None => metadata.len(),
};
for (i, pass_type) in pass_sequence.into_iter().enumerate() {
@ -532,10 +532,6 @@ fn do_pass(
Ok(())
}
fn get_file_size(path: &Path) -> Result<u64, io::Error> {
Ok(fs::metadata(path)?.len())
}
// Repeatedly renames the file with strings of decreasing length (most likely all 0s)
// Return the path of the file after its last renaming or None if error
fn wipe_name(orig_path: &Path, verbose: bool, remove_method: RemoveMethod) -> Option<PathBuf> {