fflush: also replace fclose when fixing fflush
authorEric Blake <eblake@redhat.com>
Mon, 2 May 2011 21:00:50 +0000 (15:00 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 2 May 2011 21:23:49 +0000 (15:23 -0600)
commitbcbcf0c59cec0e91db318eccdc564852bafa3c67
tree90097b56044ba8fade5482dbae1eb17e8f7af5df
parent1fc3525d1fd7dafbc946dab4c754c593f448c21c
fflush: also replace fclose when fixing fflush

This fixes the fclose failures detected in the previous patch,
but only when the GPL fflush module is also in use.  That is
because the need for behavior of resetting seekable input streams
is much less common, and the fix more complex.  The LGPLv2+ test
for fclose() in isolation is relaxed to pass if fflush is not
being replaced to cater to input streams.

* modules/fflush (Depends-on): Add fclose.
* m4/fflush.m4 (gl_FUNC_FFLUSH): Also replace fclose.
* lib/fclose.c (rpl_fclose): Don't cause spurious failures on
memstreams with no backing fd.
* doc/posix-functions/fclose.texi (fclose): Document the use of
fflush module to fix the bug.
* tests/test-fclose.c (main): Relax test when fclose is used in
isolation.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
doc/posix-functions/fclose.texi
lib/fclose.c
m4/fflush.m4
modules/fflush
tests/test-fclose.c