aboutsummaryrefslogtreecommitdiff
path: root/lzio.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-03-04 11:50:26 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1999-03-04 11:50:26 -0300
commit6233d21c9d5bda52438ac736ca4ecd57ca16bd70 (patch)
treecf0245aac5aac60923bd496541af24c7a9ec5c02 /lzio.c
parentab8ea5c38a5ac590103eaa8a3f51ee839c56b573 (diff)
downloadlua-6233d21c9d5bda52438ac736ca4ecd57ca16bd70.tar.gz
lua-6233d21c9d5bda52438ac736ca4ecd57ca16bd70.tar.bz2
lua-6233d21c9d5bda52438ac736ca4ecd57ca16bd70.zip
file stream cannot call fread after EOF.
Diffstat (limited to 'lzio.c')
-rw-r--r--lzio.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lzio.c b/lzio.c
index 04fba442..82de1a3e 100644
--- a/lzio.c
+++ b/lzio.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lzio.c,v 1.4 1998/12/28 13:44:54 roberto Exp roberto $ 2** $Id: lzio.c,v 1.5 1999/02/25 19:13:56 roberto Exp roberto $
3** a generic input stream interface 3** a generic input stream interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -41,9 +41,10 @@ ZIO* zsopen (ZIO* z, char* s, char *name)
41 41
42/* -------------------------------------------------------------- FILEs --- */ 42/* -------------------------------------------------------------- FILEs --- */
43 43
44static int zffilbuf (ZIO* z) 44static int zffilbuf (ZIO* z) {
45{ 45 int n;
46 int n=fread(z->buffer,1,ZBSIZE,z->u); 46 if (feof(z->u)) return EOZ;
47 n=fread(z->buffer,1,ZBSIZE,z->u);
47 if (n==0) return EOZ; 48 if (n==0) return EOZ;
48 z->n=n-1; 49 z->n=n-1;
49 z->p=z->buffer; 50 z->p=z->buffer;