[PATCH][BZ #11741] printf should return negative value on I/O error

Siddhesh Poyarekar siddhesh@redhat.com
Fri Oct 19 12:31:00 GMT 2012


On Fri, 19 Oct 2012 13:48:20 +0200, Andreas wrote:
> What's the significance of w == 0?  sputn should return either the
> amount of written bytes or EOF.

sputn can return 0 if none of the input bytes were written into buffer
and the overflow failed.  I wasn't sure if this behaviour was
expected, but I assume now that it isn't.  Here's an updated patch with
sputn also fixed.

Thanks,
Siddhesh

ChangeLog:

	[BZ #11741]
	* libio/fileops.c (_IO_new_file_write): Correctly return error.
	(_IO_new_file_xsputn): Also return EOF if none of the input
	data was written when overflow failed.
	* libio/iopadn.c (_IO_padn): Likewise.
	* libio/iowpadn.c (_IO_wpadn): Likewise.
	* stdio-common/tst-put-error.c: Add copyright notice.
	(do_test): Add case for printing padded string.
	* stdio-common/vfprintf [!COMPILE_WPRINTF] (PAD): Flag error if
	_IO_padn returned error.
	[COMPILE_WPRINTF] (PAD): Flag error if _IO_wpadn returned error.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr11741.patch
Type: text/x-patch
Size: 5182 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20121019/6f8fc8cf/attachment.bin>


More information about the Libc-alpha mailing list