fixed fread

This commit is contained in:
aiju 2011-05-09 14:49:41 +00:00
parent 9f13a6a654
commit 16892e5e6c

View file

@ -20,7 +20,7 @@ size_t fread(void *p, size_t recl, size_t nrec, FILE *f){
memcpy(s, f->rp, d);
f->rp+=d;
}else{
if(n >= BIGN && f->state==RD && !(f->flags&STRING) && f->buf!=f->unbuf){
if(n >= BIGN && f->state==RD && !(f->flags&STRING) && f->buf!=f->unbuf || f->buf == f->unbuf){
d=read(f->fd, s, n);
if(d<=0){
f->state=(d==0)?END:ERR;