diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-10-06 21:56:13 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-10-06 21:56:13 +0100 |
commit | 1b5151533711e1c14f78c1e65c4902506b27ba1f (patch) | |
tree | 3387e5125e0d2e6e6e277fae946850ba32a55738 | |
parent | 37ad53dee0c78deaaef3cf15212a081c8b460bed (diff) | |
download | rspamd-1b5151533711e1c14f78c1e65c4902506b27ba1f.tar.gz rspamd-1b5151533711e1c14f78c1e65c4902506b27ba1f.zip |
[Minor] Fix runtime issues
-rw-r--r-- | src/libserver/cfg_rcl.c | 6 | ||||
-rw-r--r-- | src/libstat/stat_config.c | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c index b770e14ad..5cfd73ee3 100644 --- a/src/libserver/cfg_rcl.c +++ b/src/libserver/cfg_rcl.c @@ -880,6 +880,12 @@ rspamd_rcl_set_lua_globals (struct rspamd_config *cfg, lua_State *L, lua_setglobal (L, "rspamd_classifiers"); } + lua_getglobal (L, "classifiers"); + if (lua_isnil (L, -1)) { + lua_newtable (L); + lua_setglobal (L, "classifiers"); + } + lua_getglobal (L, "rspamd_version"); if (lua_isnil (L, -1)) { lua_pushcfunction (L, rspamd_rcl_lua_version); diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c index 59159da63..f153be737 100644 --- a/src/libstat/stat_config.c +++ b/src/libstat/stat_config.c @@ -115,7 +115,7 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base) if (lua_type (L, -1) == LUA_TTABLE) { lua_pushnil (L); - while (lua_next (L, -1) != 0) { + while (lua_next (L, -2) != 0) { lua_classifiers_cnt ++; lua_pop (L, 1); } @@ -138,7 +138,7 @@ rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base) if (lua_type (L, -1) == LUA_TTABLE) { lua_pushnil (L); - while (lua_next (L, -1) != 0) { + while (lua_next (L, -2) != 0) { lua_pushvalue (L, -2); memcpy (&stat_ctx->classifiers_subrs[i], &lua_classifier, sizeof (struct rspamd_stat_classifier)); |