From 9f13a6a654f129a561d2e2a0f8fafb12f4f467a5 Mon Sep 17 00:00:00 2001 From: aiju Date: Mon, 9 May 2011 14:42:01 +0000 Subject: [PATCH] fixed fwrite (hopefully didn't break anything) --- sys/src/ape/lib/ap/stdio/fwrite.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/src/ape/lib/ap/stdio/fwrite.c b/sys/src/ape/lib/ap/stdio/fwrite.c index 5e871c069..c926dbf4d 100644 --- a/sys/src/ape/lib/ap/stdio/fwrite.c +++ b/sys/src/ape/lib/ap/stdio/fwrite.c @@ -39,9 +39,11 @@ size_t fwrite(const void *p, size_t recl, size_t nrec, FILE *f){ goto ret; } }else{ - if(_IO_putc(*s, f)==EOF) + if(f->flags&APPEND) lseek(f->fd, 0L, SEEK_END); + if((d=write(f->fd, s, n))<=0) { + f->state=ERR; goto ret; - d=1; + } } } s+=d;