summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/stdio/fwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/src/ape/lib/ap/stdio/fwrite.c')
-rw-r--r--sys/src/ape/lib/ap/stdio/fwrite.c6
1 files 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;