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
F87053211: D34007.diff
Fri, Jun 28, 6:03 PM
Unknown Object (File)
Sun, Jun 2, 2:00 AM
Unknown Object (File)
Mar 10 2024, 3:10 AM
Unknown Object (File)
Feb 9 2024, 6:26 AM
Unknown Object (File)
Jan 18 2024, 12:00 PM
Unknown Object (File)
Jan 14 2024, 7:57 PM
Unknown Object (File)
Dec 22 2023, 10:21 PM
Unknown Object (File)
Dec 12 2023, 6:04 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