svn commit: r270035 - stable/10/lib/libc/stdio
Andrey Chernov
ache at freebsd.org
Sun Aug 17 18:20:40 UTC 2014
On 16.08.2014 5:29, Pedro F. Giffuni wrote:
> Author: pfg
> Date: Sat Aug 16 01:29:49 2014
> New Revision: 270035
> URL: http://svnweb.freebsd.org/changeset/base/270035
>
> Log:
> MFC r268924:
> Update fflush(3) to return success on a read-only stream.
>
> This is done for compliance with SUSv3. The changes cause
> no secondary effects in the gnulib tests (we pass them).
...
> @@ -122,6 +123,12 @@ __sflush(FILE *fp)
> for (; n > 0; n -= t, p += t) {
> t = _swrite(fp, (char *)p, n);
> if (t <= 0) {
> + /* Reset _p and _w. */
> + if (p > fp->_p) /* Some was written. */
> + memmove(fp->_p, p, n);
> + fp->_p += n;
> + if ((fp->_flags & (__SLBF | __SNBF)) == 0)
> + fp->_w -= n;
> fp->_flags |= __SERR;
> return (EOF);
> }
>
The description is incomplete. This code also does internal stdio
structure adjustment for partial write.
--
http://ache.vniz.net/
More information about the svn-src-all
mailing list