From 2b766585f9b4ffabeef2f36200c275976b93f2c7 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Fri, 16 Nov 2012 19:13:11 +0530 Subject: printf should return negative value on error [BZ #11741] Fixed bug where printf and family may return a spurious success when printing padded formats. --- libio/iopadn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libio/iopadn.c') diff --git a/libio/iopadn.c b/libio/iopadn.c index 7e37450..b7a4c5a 100644 --- a/libio/iopadn.c +++ b/libio/iopadn.c @@ -59,7 +59,7 @@ _IO_padn (fp, pad, count) w = _IO_sputn (fp, padptr, PADSIZE); written += w; if (w != PADSIZE) - return written; + return w == EOF ? w : written; } if (i > 0) -- cgit v1.1