[PATCH 2/2] libio: Perform write-only fflush as part of freopen (bug 30731)

Andreas Schwab schwab@suse.de
Tue Aug 8 13:49:22 GMT 2023


On Aug 08 2023, Florian Weimer via Libc-alpha wrote:

> For standard streams that have a file descriptor, the read flush
> may change the file offset of the underlying file descriptor.  This
> is undeseriable because it makes using freopen after fork unsafe
> even for read-only files.

The POSIX standard says that fflush should be called unconditionally,
which means that it expects all side effects to happen.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list