diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-01 15:14:43 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-09-01 15:14:43 +0100 |
commit | f778850980db0ff24b462b169d2ded48000dd5c6 (patch) | |
tree | 03b3ddd6af96e3254c3f1ed2807ab53ce16954eb /src/libstat/stat_process.c | |
parent | 03630564dc8139b66a54f4e353ca1b92a5a8f40f (diff) | |
download | rspamd-f778850980db0ff24b462b169d2ded48000dd5c6.tar.gz rspamd-f778850980db0ff24b462b169d2ded48000dd5c6.zip |
[Minor] Fix number of arguments to invoke a lua function
Diffstat (limited to 'src/libstat/stat_process.c')
-rw-r--r-- | src/libstat/stat_process.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 4e856b563..13083986f 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -201,6 +201,7 @@ rspamd_stat_classifier_is_skipped (struct rspamd_task *task, while (cur) { gint cb_ref = GPOINTER_TO_INT (cur->data); gint old_top = lua_gettop (L); + gint nargs; lua_rawgeti (L, LUA_REGISTRYINDEX, cb_ref); /* Push task and two booleans: is_spam and is_unlearn */ @@ -212,9 +213,13 @@ rspamd_stat_classifier_is_skipped (struct rspamd_task *task, lua_pushboolean(L, is_spam); lua_pushboolean(L, task->flags & RSPAMD_TASK_FLAG_UNLEARN ? true : false); + nargs = 3; + } + else { + nargs = 1; } - if (lua_pcall (L, 3, LUA_MULTRET, 0) != 0) { + if (lua_pcall (L, nargs, LUA_MULTRET, 0) != 0) { msg_err_task ("call to %s failed: %s", "condition callback", lua_tostring (L, -1)); |