summaryrefslogtreecommitdiff
path: root/libc/stdio/_WRITE.c
diff options
context:
space:
mode:
authorJan Vangorp <jan.vangorp_ext@softathome.com>2016-06-09 00:00:49 +0200
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2016-06-12 11:44:45 +0200
commit96f2821683ec41a28b5aa6ec92245e47dfee989b (patch)
tree807f48ec85a5f2f02ac09146e89dfd831eb90339 /libc/stdio/_WRITE.c
parent568ceebf6adfc58c64a95133311268db626cdec2 (diff)
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>
Diffstat (limited to 'libc/stdio/_WRITE.c')
-rw-r--r--libc/stdio/_WRITE.c1
1 files changed, 1 insertions, 0 deletions
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