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, Mar 23, 6:45 AM
Unknown Object (File)
Sat, Mar 21, 12:57 PM
Unknown Object (File)
Thu, Mar 19, 6:57 AM
Unknown Object (File)
Sat, Mar 14, 3:04 PM
Unknown Object (File)
Mon, Mar 9, 1:10 PM
Unknown Object (File)
Feb 12 2026, 7:43 PM
Unknown Object (File)
Feb 8 2026, 12:02 PM
Unknown Object (File)
Feb 8 2026, 1:36 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