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
F147262754: D34007.diff
Mon, Mar 9, 1:10 PM
Unknown Object (File)
Thu, Feb 12, 7:43 PM
Unknown Object (File)
Sun, Feb 8, 12:02 PM
Unknown Object (File)
Feb 8 2026, 1:36 AM
Unknown Object (File)
Jan 31 2026, 12:42 AM
Unknown Object (File)
Jan 17 2026, 4:10 PM
Unknown Object (File)
Jan 15 2026, 2:48 AM
Unknown Object (File)
Jan 5 2026, 10:52 PM
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