about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/stdio/fwrite.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stdio/fwrite.c b/src/stdio/fwrite.c
index 81ec271e..fa30c0d3 100644
--- a/src/stdio/fwrite.c
+++ b/src/stdio/fwrite.c
@@ -13,8 +13,8 @@ size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
 		/* Match /^(.*\n|)/ */
 		for (i=l; i && s[i-1] != '\n'; i--);
 		if (i) {
-			if (f->write(f, s, i) < i)
-				return i;
+			size_t n = f->write(f, s, i);
+			if (n < i) return n;
 			s += i;
 			l -= i;
 		}