aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ldo.c b/ldo.c
index 36304fb7..7ab130af 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 1.123 2001/02/07 18:13:49 roberto Exp roberto $ 2** $Id: ldo.c,v 1.124 2001/02/20 18:15:33 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -265,12 +265,9 @@ static int parse_file (lua_State *L, const char *filename) {
265 ZIO z; 265 ZIO z;
266 int status; 266 int status;
267 int bin; /* flag for file mode */ 267 int bin; /* flag for file mode */
268 int c; /* look ahead char */
269 FILE *f = (filename == NULL) ? stdin : fopen(filename, "r"); 268 FILE *f = (filename == NULL) ? stdin : fopen(filename, "r");
270 if (f == NULL) return LUA_ERRFILE; /* unable to open file */ 269 if (f == NULL) return LUA_ERRFILE; /* unable to open file */
271 c = fgetc(f); 270 bin = (ungetc(fgetc(f), f) == ID_CHUNK);
272 ungetc(c, f);
273 bin = (c == ID_CHUNK);
274 if (bin && f != stdin) { 271 if (bin && f != stdin) {
275 fclose(f); 272 fclose(f);
276 f = fopen(filename, "rb"); /* reopen in binary mode */ 273 f = fopen(filename, "rb"); /* reopen in binary mode */