Re: [PATCH 3/3] fclose: pacify gcc -Wanalyzer-file-leak

2023-04-25 Thread Bruno Haible
Paul Eggert wrote: > diff --git a/m4/fclose.m4 b/m4/fclose.m4 > index dc021dd9f3..74b7df0a77 100644 > --- a/m4/fclose.m4 > +++ b/m4/fclose.m4 > @@ -31,6 +31,10 @@ AC_DEFUN([gl_FUNC_FCLOSE], >*) REPLACE_FCLOSE=1 ;; > esac >fi > + > + if test $REPLACE_FCLOSE = 1; then > +REPLACE

[PATCH 3/3] fclose: pacify gcc -Wanalyzer-file-leak

2023-04-24 Thread Paul Eggert
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_fclo