diff options
author | aiju <aiju@phicode.de> | 2011-05-09 14:42:01 +0000 |
---|---|---|
committer | aiju <aiju@phicode.de> | 2011-05-09 14:42:01 +0000 |
commit | 9f13a6a654f129a561d2e2a0f8fafb12f4f467a5 (patch) | |
tree | 4385ae833500cf6e9290d4604a6cc45e308fa518 | |
parent | b9427c8a3fb4fa2e4b0719a66302c6d839d92bca (diff) | |
download | plan9front-9f13a6a654f129a561d2e2a0f8fafb12f4f467a5.tar.xz |
fixed fwrite (hopefully didn't break anything)
-rw-r--r-- | sys/src/ape/lib/ap/stdio/fwrite.c | 6 |
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; |