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)
Mon, Nov 3, 4:40 AM
Unknown Object (File)
Oct 19 2025, 2:41 AM
Unknown Object (File)
Oct 5 2025, 5:31 AM
Unknown Object (File)
Sep 2 2025, 10:17 PM
Unknown Object (File)
Aug 24 2025, 10:56 PM
Unknown Object (File)
Aug 15 2025, 9:54 PM
Unknown Object (File)
Aug 6 2025, 3:46 AM
Unknown Object (File)
Aug 3 2025, 12:05 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 Not Applicable
Unit
Tests Not Applicable

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