From: Matthew Vernon Date: Fri, 7 Nov 2025 11:52:59 +0000 (+0000) Subject: Check fread return status x3 X-Git-Tag: archive/debian/4.40~2 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=a048b783838b2c7162fa3c9d2ea9a476e7aac850;p=bible-kjv.git Check fread return status x3 Again, spotted by newer build tools. --- diff --git a/buildcmp.c b/buildcmp.c index 9d97788..aef3358 100644 --- a/buildcmp.c +++ b/buildcmp.c @@ -94,10 +94,16 @@ static void put_header(void) strncpy( fh.description, "Compressed Data File", TSL_DESCRSZ ); /* Process the squish statistics */ - fread( &d, sizeof(int), 1, sf ); + if(fread( &d, sizeof(int), 1, sf ) < 1){ + perror("Failed to read Window size from squish.stats"); + exit(1); + } printf( "Window size (bytes): %d\n", d ); univ_assign(fh.wsize, d); - fread( &d, sizeof(int), 1, sf ); + if(fread( &d, sizeof(int), 1, sf ) < 1){ + perror("Failed to read Number of windows from squish.stats"); + exit(1); + } printf( "Number of windows: %d\n", d ); count = d; univ_assign(fh.wnum, d); @@ -110,7 +116,10 @@ static void put_header(void) winx = (Univ_Int *) w_table; for (i=0; i <= count; i++) { - fread( &d, sizeof(int), 1, sf ); + if(fread( &d, sizeof(int), 1, sf ) < 1){ + perror("Failed to read Window start point from squish.stats"); + exit(1); + } univ_assign(*winx++, j=d+headersize); printf( "Window[%d] starts at %d\n", i, j ); }