Page MenuHomeFreeBSD

__sflush(): on write error, if nothing was written, reset FILE state back
ClosedPublic

Authored by kib on Jan 23 2022, 7:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Oct 23, 10:37 PM
Unknown Object (File)
Wed, Oct 23, 10:37 PM
Unknown Object (File)
Mon, Oct 21, 3:00 AM
Unknown Object (File)
Oct 3 2024, 12:30 AM
Unknown Object (File)
Oct 2 2024, 6:40 PM
Unknown Object (File)
Sep 28 2024, 6:10 PM
Unknown Object (File)
Sep 28 2024, 8:08 AM
Unknown Object (File)
Sep 26 2024, 7:01 AM
Subscribers

Details

Summary
otherwise the data is just dropped.  Check for current position equal to
the buffer base at the entry of the function; if not equal, setvbuf()
was done from the write method and it is not our business to override
the decision.

PR:     76398

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Jan 23 2022, 7:02 AM
lib/libc/stdio/fflush.c
133

Shouldn't this also be fp->_p == old_p && p > fp->_p?

lib/libc/stdio/fflush.c
133

May be. But this is definitely a separate change.

In fact I am not sure what should be a contract for custom streams which do setvbuf() and return error from the write method.

This revision is now accepted and ready to land.Jan 25 2022, 1:30 AM