Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Aug 2014 14:11:36 -0500
From:      Pedro Giffuni <pfg@freebsd.org>
To:        Andrey Chernov <ache@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:  <53F0FE68.6080501@freebsd.org>
In-Reply-To: <53F0F263.7040202@freebsd.org>
References:  <201408160129.s7G1TojV024013@svn.freebsd.org> <53F0F263.7040202@freebsd.org>

index | next in thread | previous in thread | raw e-mail


On 08/17/14 13:20, Andrey Chernov wrote:
> 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.
>
Oh  yes, I forgot about that part.

The story is that Apple only does this for EAGAIN but Bruce suggested it
should be done for other errors as well.

TBH, I wasn't going to merge this change but it seemed consistent to have
all the changes that originated from Apple's libc together.

Pedro.




help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53F0FE68.6080501>