From 5a41f0c7d6d5d86132c703a183dd3b0dcb6bd61c Mon Sep 17 00:00:00 2001 From: Matthew Vernon Date: Fri, 7 Nov 2025 11:34:45 +0000 Subject: [PATCH] makeindex: check return of fgets MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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] --- makeindex.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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++; } -- 2.30.2