From abd40e3f96472e106ba21b0be95b76954ba1158f Mon Sep 17 00:00:00 2001 From: sven Date: Wed, 24 Sep 2008 07:39:28 +0000 Subject: [PATCH] make --script-updatedb skip scripts producing load errors --- nse_init.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nse_init.cc b/nse_init.cc index 3a2b161e8..2f4036eff 100644 --- a/nse_init.cc +++ b/nse_init.cc @@ -452,7 +452,16 @@ int init_updatedb (lua_State *L) luaL_error(L, "file '%s' could not be loaded", file); lua_pushvalue(L, -2); // push environment lua_setfenv(L, -2); // set it - lua_call(L, 0, 0); + if ( lua_pcall(L, 0, 0, 0) != 0 ) { + // skip scripts that produce errors + log_write(LOG_STDOUT, "%s: Skipping script '%s' because it produced errors while loading.\n", + SCRIPT_ENGINE, file ); + SCRIPT_ENGINE_VERBOSE( + error("%s", lua_tostring(L, -1)); + ) + lua_pop(L, 3); + continue; + } lua_getfield(L, -1, "categories"); if (lua_isnil(L, -1))