Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: fusl/src/stdio/fwrite.c

Issue 1689833004: [fusl] Update fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: remove stray space Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fusl/src/stdio/fread.c ('k') | fusl/src/thread/arm/atomics.s » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/stdio/fwrite.c
diff --git a/fusl/src/stdio/fwrite.c b/fusl/src/stdio/fwrite.c
index 81ec271e1bcb7ba477f92c8af74e4cc159deb032..7a567b2c55a94b30288444bd93f6fc48fff7e433 100644
--- a/fusl/src/stdio/fwrite.c
+++ b/fusl/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;
}
@@ -28,6 +28,7 @@ size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
size_t fwrite(const void *restrict src, size_t size, size_t nmemb, FILE *restrict f)
{
size_t k, l = size*nmemb;
+ if (!size) nmemb = 0;
FLOCK(f);
k = __fwritex(src, l, f);
FUNLOCK(f);
« no previous file with comments | « fusl/src/stdio/fread.c ('k') | fusl/src/thread/arm/atomics.s » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698