Ping[3]: [PATCH][BZ #11741] printf should return negative value on I/O error
Carlos O'Donell
carlos@systemhalted.org
Fri Nov 16 04:00:00 GMT 2012
On Thu, Nov 15, 2012 at 10:50 PM, Siddhesh Poyarekar
<siddhesh@redhat.com> wrote:
> On Thu, 15 Nov 2012 22:22:26 -0500, Carlos wrote:
>> Though when I look at the code I don't see that _IO_sputn
>> can ever return EOF, so while your change is robust, it's
>> not really required. As far as I see _IO_sputn is the same
>> as _IO_default_xsputn, which always returns the number of
>> bytes written.
>>
>> Therefore your changes to libio/iopadn.c and libio/iowpadn.c
>> are superfluous.
>>
>> Can you please confirm that you need those changes?
>
> Not for the fix, no. I made the changes because I wasn't sure if
> returning 0 was expected behaviour or not. The original patch[1] works
> just as well.
Your original patch still suffers the same problem, you make
a change to libio/iowpadn.c that isn't needed?
diff --git a/libio/iowpadn.c b/libio/iowpadn.c
index 05632d5..334e01a 100644
--- a/libio/iowpadn.c
+++ b/libio/iowpadn.c
@@ -65,7 +65,7 @@ _IO_wpadn (fp, pad, count)
w = _IO_sputn (fp, (char *) padptr, PADSIZE);
written += w;
if (w != PADSIZE)
- return written;
+ return w <= 0 ? w : written;
}
if (i > 0)
---
Can you confirm you need this change?
OK to checkin if you confirm this change *isn't* needed.
Cheers,
Carlos.
More information about the Libc-alpha
mailing list