From c7b89dd28097296bbc14d9b47b4cea72514b2b76 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 3 Jul 2006 17:16:49 -0300 Subject: small bug: should not use string after popping it --- loadlib.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'loadlib.c') diff --git a/loadlib.c b/loadlib.c index 41082e59..6964b567 100644 --- a/loadlib.c +++ b/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.52 2006/04/10 18:27:23 roberto Exp roberto $ +** $Id: loadlib.c,v 1.53 2006/06/22 16:12:59 roberto Exp roberto $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** @@ -360,11 +360,12 @@ static const char *findfile (lua_State *L, const char *name, while ((path = pushnexttemplate(L, path)) != NULL) { const char *filename; filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ if (readable(filename)) /* does file exist and is readable? */ return filename; /* return that file name */ - lua_pop(L, 2); /* remove path template and file name */ luaO_pushfstring(L, "\n\tno file " LUA_QS, filename); - lua_concat(L, 2); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ } return NULL; /* not found */ } -- cgit v1.2.3-55-g6feb