]> git.ipfire.org Git - thirdparty/glibc.git/commit
Make fflush (NULL) flush input files (bug 32369)
authorJoseph Myers <josmyers@redhat.com>
Tue, 28 Jan 2025 21:53:49 +0000 (21:53 +0000)
committerJoseph Myers <josmyers@redhat.com>
Tue, 28 Jan 2025 21:53:49 +0000 (21:53 +0000)
commit94251ae99edaa911f4cb8056748dca0874ea268c
tree6ebe24522cb1b099531daebe8c63765e0080140a
parentbe6818be31e756398e45f70e2819d78be0961223
Make fflush (NULL) flush input files (bug 32369)

As discussed in bug 32369 and required by POSIX, the POSIX feature
fflush (NULL) should flush input files, not just output files.  The
POSIX requirement is that "fflush() shall perform this flushing action
on all streams for which the behavior is defined above", and the
definition for input files is for "a stream open for reading with an
underlying file description, if the file is not already at EOF, and
the file is one capable of seeking".

Implement this requirement in glibc.  (The underlying flushing
implementation is what deals with avoiding errors for seeking on an
unseekable file.)

Tested for x86_64.
libio/genops.c
stdio-common/Makefile
stdio-common/tst-fflush-all-input.c [new file with mode: 0644]