From 96f2821683ec41a28b5aa6ec92245e47dfee989b Mon Sep 17 00:00:00 2001 From: Jan Vangorp Date: Thu, 9 Jun 2016 00:00:49 +0200 Subject: Fix return value of fwrite when a 'hard' error occurs When a 'hard' error occurs, fwrite reports that all data was written or buffered even if that is not the case. It should report how much data was actually written and buffered. Signed-off-by: Jan Vangorp --- libc/stdio/_WRITE.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libc') diff --git a/libc/stdio/_WRITE.c b/libc/stdio/_WRITE.c index 113f0eb86..f95bd1ba9 100644 --- a/libc/stdio/_WRITE.c +++ b/libc/stdio/_WRITE.c @@ -76,6 +76,7 @@ size_t attribute_hidden __stdio_WRITE(register FILE *stream, */ if (errno != EINTR && errno != EAGAIN) { /* do we have other "soft" errors? */ + bufsize -= todo; break; } #ifdef __STDIO_BUFFERS -- cgit v1.2.3