[thin_metadata_unpack] Fix truncated output file on invalid input

Check the input header before creating or truncating the output file
This commit is contained in:
Ming-Hung Tsai
2021-07-08 11:41:28 +08:00
parent 6cecf0f673
commit a50c9d97e2
2 changed files with 15 additions and 11 deletions

View File

@@ -39,7 +39,7 @@ fn main() {
}
if let Err(reason) = thinp::pack::toplevel::unpack(&input_file, &output_file) {
println!("Application error: {}", reason);
eprintln!("Application error: {}", reason);
process::exit(1);
}
}