Date: Sun, 17 Aug 2014 22:20:19 +0400 From: Andrey Chernov <ache@freebsd.org> To: "Pedro F. Giffuni" <pfg@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r270035 - stable/10/lib/libc/stdio Message-ID: <53F0F263.7040202@freebsd.org> In-Reply-To: <201408160129.s7G1TojV024013@svn.freebsd.org> References: <201408160129.s7G1TojV024013@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53F0F263.7040202>