diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-03-04 11:50:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-03-04 11:50:26 -0300 |
commit | 6233d21c9d5bda52438ac736ca4ecd57ca16bd70 (patch) | |
tree | cf0245aac5aac60923bd496541af24c7a9ec5c02 | |
parent | ab8ea5c38a5ac590103eaa8a3f51ee839c56b573 (diff) | |
download | lua-6233d21c9d5bda52438ac736ca4ecd57ca16bd70.tar.gz lua-6233d21c9d5bda52438ac736ca4ecd57ca16bd70.tar.bz2 lua-6233d21c9d5bda52438ac736ca4ecd57ca16bd70.zip |
file stream cannot call fread after EOF.
-rw-r--r-- | bugs | 5 | ||||
-rw-r--r-- | lzio.c | 9 |
2 files changed, 10 insertions, 4 deletions
@@ -70,3 +70,8 @@ lua_isnumber can modify it. | |||
70 | ** lstrlib.c | 70 | ** lstrlib.c |
71 | Thu Feb 4 17:08:50 EDT 1999 | 71 | Thu Feb 4 17:08:50 EDT 1999 |
72 | >> format "%s" may break limit of "sprintf" on some machines. | 72 | >> format "%s" may break limit of "sprintf" on some machines. |
73 | |||
74 | |||
75 | ** lzio.c | ||
76 | Thu Mar 4 11:49:37 EST 1999 | ||
77 | >> file stream cannot call fread after EOF. | ||
@@ -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 | ||
44 | static int zffilbuf (ZIO* z) | 44 | static 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; |