Explorar o código

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 %!s(int64=8) %!d(string=hai) anos
pai
achega
96f2821683
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  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