From 0c3e0fd95d4375da18917563b14252e1700bd3bb Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 10 Nov 1995 16:32:59 -0200 Subject: [PATCH] "read" must return 'nil' on EOF. --- iolib.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iolib.c b/iolib.c index 656c1b5b..37ad50ce 100644 --- a/iolib.c +++ b/iolib.c @@ -3,7 +3,7 @@ ** Input/output library to LUA */ -char *rcs_iolib="$Id: iolib.c,v 1.27 1995/11/03 15:43:50 roberto Exp roberto $"; +char *rcs_iolib="$Id: iolib.c,v 1.28 1995/11/10 17:55:48 roberto Exp roberto $"; #include #include @@ -247,6 +247,11 @@ static void read_free (void) int c; while (isspace(c=fgetc(in))) ; + if (c == EOF) + { + lua_pushnil(); + return; + } if (c == '\"' || c == '\'') { /* string */ c = read_until_char(c);