[PATCH 2/2] libio: Perform write-only fflush as part of freopen (bug 30731)
Florian Weimer
fweimer@redhat.com
Tue Aug 8 13:59:37 GMT 2023
* Andreas Schwab:
> 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.
Hmm. I think we might be in undefined territory here. But taking a
second look at it, the current (unpatched) behavior is probably more
generally useful.
I would like to apply the first patch as a cleanup, though.
Thanks,
Florian
More information about the Libc-alpha
mailing list