aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lauxlib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lauxlib.c b/lauxlib.c
index 74429996..7f7075e8 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.184 2009/02/27 18:18:19 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.185 2009/03/31 17:25:08 roberto Exp roberto $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -496,6 +496,9 @@ static const char *getF (lua_State *L, void *ud, size_t *size) {
496 *size = 1; 496 *size = 1;
497 return "\n"; 497 return "\n";
498 } 498 }
499 /* 'fread' can return > 0 *and* set the EOF flag. If next call to
500 'getF' calls 'fread', terminal may still wait for user input.
501 The next check avoids this problem. */
499 if (feof(lf->f)) return NULL; 502 if (feof(lf->f)) return NULL;
500 *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); 503 *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f);
501 return (*size > 0) ? lf->buff : NULL; 504 return (*size > 0) ? lf->buff : NULL;