From cea106fb8976d04b916953469439bc58fa111266 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 20 Jun 2012 15:04:47 -0400 Subject: [PATCH] fix fwrite return value when full write does not succeed --- src/stdio/fwrite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdio/fwrite.c b/src/stdio/fwrite.c index 02908c4b..1b8641ac 100644 --- a/src/stdio/fwrite.c +++ b/src/stdio/fwrite.c @@ -31,7 +31,7 @@ size_t fwrite(const void *src, size_t size, size_t nmemb, FILE *f) FLOCK(f); k = __fwritex(src, l, f); FUNLOCK(f); - return k==l ? nmemb : l/size; + return k==l ? nmemb : k/size; } weak_alias(fwrite, fwrite_unlocked); -- 2.25.1