aboutsummaryrefslogtreecommitdiff
path: root/src/extract.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-21 05:20:35 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-21 05:20:35 -0500
commit44541066424e2ff1490f25a2b512a1a609506243 (patch)
tree1cff011cf6b64522d80bfb50dfcffeb44268410a /src/extract.c
parent24dd2ee784574cf3b21d19421015ac67034a22d0 (diff)
downloadunalf-44541066424e2ff1490f25a2b512a1a609506243.tar.gz
Complain if extracted file size doesn't match orig size in ALF header.
Diffstat (limited to 'src/extract.c')
-rw-r--r--src/extract.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/extract.c b/src/extract.c
index aa7f75b..0fb61f4 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -3,6 +3,7 @@
int bad_checksum, bad_checksum_count = 0;
int new_file = 0;
+unsigned int bytes_written = 0;
char *out_filename;
void dpoke(int addr, u16 value) {
@@ -153,10 +154,13 @@ void extract_alf(void) {
out_filename = realname;
}
- bad_checksum = 0;
+ bad_checksum = bytes_written = 0;
new_file = 1;
uncrunch_file();
if(bad_checksum) bad_checksum_count++;
+ if(bytes_written != getquad(alf_hdr_origsize0))
+ fprintf(stderr, "%s: %s should be %u bytes, but extracted to %u.\n",
+ self, out_filename, getquad(alf_hdr_origsize0), bytes_written);
if(!opts.extract_to_stdout) fclose(out_file);
out_filename = 0;