[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 committed 2021-07-09 01:22:22 +08:00
1 parent 6cecf0f673
commit a50c9d97e2
2 files changed
+15 -11

No files matched your search

+1 -1
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);
}
}