diff options
author | cinap_lenrek <cinap_lenrek@localhost> | 2011-05-10 05:33:43 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@localhost> | 2011-05-10 05:33:43 +0000 |
commit | 3a78a07143fc793923e9f965820d97f4b3de6ec4 (patch) | |
tree | 0d1ca3ed0ac24e05000ed971f19caaa77f841c70 /sys/src/ape/lib/ap/stdio/fwrite.c | |
parent | b73e068bfeff7337bf593fa5b2d2858c89f5f13e (diff) |
ape: fix fread/fwrite, python: disable bytecode dumps, inst: rename textonly to start and remove inst/gui, add sys/lib/rootbind, cisfd(8) manpage
Diffstat (limited to 'sys/src/ape/lib/ap/stdio/fwrite.c')
-rw-r--r-- | sys/src/ape/lib/ap/stdio/fwrite.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/src/ape/lib/ap/stdio/fwrite.c b/sys/src/ape/lib/ap/stdio/fwrite.c index c926dbf4d..4dc18d99e 100644 --- a/sys/src/ape/lib/ap/stdio/fwrite.c +++ b/sys/src/ape/lib/ap/stdio/fwrite.c @@ -20,7 +20,7 @@ size_t fwrite(const void *p, size_t recl, size_t nrec, FILE *f){ memcpy(f->wp, s, d); f->wp+=d; }else{ - if(n>=BIGN && f->state==WR && !(f->flags&(STRING|LINEBUF)) && f->buf!=f->unbuf){ + if(f->buf==f->unbuf || (n>=BIGN && f->state==WR && !(f->flags&(STRING|LINEBUF)))){ d=f->wp-f->buf; if(d>0){ if(f->flags&APPEND) @@ -38,12 +38,10 @@ size_t fwrite(const void *p, size_t recl, size_t nrec, FILE *f){ f->state=ERR; goto ret; } - }else{ - if(f->flags&APPEND) lseek(f->fd, 0L, SEEK_END); - if((d=write(f->fd, s, n))<=0) { - f->state=ERR; + } else { + if(_IO_putc(*s, f)==EOF) goto ret; - } + d=1; } } s+=d; |