1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-07 05:56:34 +00:00

Don't use global o.cmdexec in lua_setup.

Pass the name of the file to read as a parameter.
This commit is contained in:
david
2013-09-05 20:35:50 +00:00
parent a16dd65503
commit 3ada0d56c3
3 changed files with 7 additions and 8 deletions

View File

@@ -148,16 +148,16 @@ static int traceback (lua_State *L)
return 1;
}
lua_State *lua_setup(void)
lua_State *lua_setup(const char *filename)
{
lua_State *L;
ncat_assert(o.cmdexec != NULL);
ncat_assert(filename != NULL);
L = luaL_newstate();
luaL_openlibs(L);
if (luaL_loadfile(L, o.cmdexec) != 0)
if (luaL_loadfile(L, filename) != 0)
report(L, "Error loading the Lua script");
return L;
@@ -173,7 +173,7 @@ void lua_run(lua_State *L)
report(L, "Error running the Lua script");
} else {
if (o.debug)
logdebug("%s returned successfully.\n", o.cmdexec);
logdebug("Lua script returned successfully.\n");
lua_close(L);
exit(EXIT_SUCCESS);
}