Browse Source

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 <jan.vangorp_ext@softathome.com>
Jan Vangorp 8 years ago
parent
commit
96f2821683
1 changed files with 1 additions and 0 deletions
  1. 1 0
      libc/stdio/_WRITE.c

+ 1 - 0
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