From: Matthew Vernon Date: Fri, 7 Nov 2025 11:34:45 +0000 (+0000) Subject: makeindex: check return of fgets X-Git-Tag: archive/debian/4.40~4 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~matthewv/git?a=commitdiff_plain;h=5a41f0c7d6d5d86132c703a183dd3b0dcb6bd61c;p=bible-kjv.git makeindex: check return of fgets Not doing so was flagged by newer build tooling: makeindex.c:127:9: error: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] --- diff --git a/makeindex.c b/makeindex.c index abcb26b..eca05a8 100644 --- a/makeindex.c +++ b/makeindex.c @@ -124,7 +124,12 @@ int main(int argc,char **argv) printf( "%ld, ", offset ); /* Determine offset of next line */ - fgets( textbuff, TBSIZE, fp); + if (fgets( textbuff, TBSIZE, fp) == NULL) { + if (ferror(fp)) { + perror("fgets when determining line offset"); + return 1; + } + } offset += strlen(textbuff); cur_line++; }