fix fwrite return value when full write does not succeed
authorRich Felker <dalias@aerifal.cx>
Wed, 20 Jun 2012 19:04:47 +0000 (15:04 -0400)
committerRich Felker <dalias@aerifal.cx>
Wed, 20 Jun 2012 19:04:47 +0000 (15:04 -0400)
src/stdio/fwrite.c

index 02908c4b9ad39176d4b5f6591a0b3d72518d20d5..1b8641acadbfc5f9d9c34070ba6b424ee63dabb3 100644 (file)
@@ -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);