From 16892e5e6c85e2562c5ac6e497efa45d7c4bfff1 Mon Sep 17 00:00:00 2001 From: aiju Date: Mon, 9 May 2011 14:49:41 +0000 Subject: [PATCH] fixed fread --- sys/src/ape/lib/ap/stdio/fread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/ape/lib/ap/stdio/fread.c b/sys/src/ape/lib/ap/stdio/fread.c index 3345011b6..cf66c54fb 100644 --- a/sys/src/ape/lib/ap/stdio/fread.c +++ b/sys/src/ape/lib/ap/stdio/fread.c @@ -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;