Explorar o código

fix fwrite return value when full write does not succeed

Rich Felker %!s(int64=12) %!d(string=hai) anos
pai
achega
cea106fb89
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/stdio/fwrite.c

+ 1 - 1
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);