]> Savannah Git Hosting - gnulib.git/commit
fclose: pacify gcc -Wanalyzer-file-leak
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Apr 2023 19:06:55 +0000 (12:06 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 24 Apr 2023 19:07:40 +0000 (12:07 -0700)
commit4bb14d69493fd3bbc328b86755420892a88d3fd8
treefc09f7a7eefc2cc077dc4b9bb4ce77961da52669
parentb98993a1baaa2fc39b301676ecbd8bb29e1d9c96
fclose: pacify gcc -Wanalyzer-file-leak

Without this patch, building coreutils with
--enable-gcc-checking=expensive would fail with a message like
“lib/exclude.c:682:6: error: leak of FILE 'in' [CWE-775]
[-Werror=analyzer-file-leak]”, because Gnulib replaced fclose but
not fopen, and GCC saw a call to fopen followed by a call to
rpl_fclose.  The patch causes GCC to instead see a call to
rpl_fopen followed by rpl_fclose.
* m4/fclose.m4 (gl_FUNC_FCLOSE): Replace fopen when replacing
fclose.
* modules/fclose (Depends-on): Add fopen.
(configure.ac): Replace fopen when replacing fclose.
ChangeLog
m4/fclose.m4
modules/fclose