aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamadm/rspamadm.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-31 15:53:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-01-31 15:53:38 +0100
commita37e514fc12141b6cd26d43bdd410e201285f5d3 (patch)
tree73fdf232a9b9c7b31f68f085d869d3155a1a2564 /src/rspamadm/rspamadm.c
parent739d63244f84347633bb243955f094dcec4b0ab1 (diff)
downloadrspamd-a37e514fc12141b6cd26d43bdd410e201285f5d3.tar.gz
rspamd-a37e514fc12141b6cd26d43bdd410e201285f5d3.zip
Add more diagnostic for lua subr errors
Diffstat (limited to 'src/rspamadm/rspamadm.c')
-rw-r--r--src/rspamadm/rspamadm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c
index a170b5830..96022bc9f 100644
--- a/src/rspamadm/rspamadm.c
+++ b/src/rspamadm/rspamadm.c
@@ -207,7 +207,7 @@ rspamadm_execute_lua_ucl_subr (gpointer pL, gint argc, gchar **argv,
const ucl_object_t *res, const gchar *script)
{
lua_State *L = pL;
- gint err_idx, cb_idx, i;
+ gint err_idx, cb_idx, i, ret;
GString *tb;
g_assert (script != NULL);
@@ -249,10 +249,14 @@ rspamadm_execute_lua_ucl_subr (gpointer pL, gint argc, gchar **argv,
/* Push results */
ucl_object_push_lua (L, res, TRUE);
- if (lua_pcall (L, 2, 0, err_idx) != 0) {
+ if ((ret = lua_pcall (L, 2, 0, err_idx)) != 0) {
tb = lua_touserdata (L, -1);
- msg_err ("call to adm lua script failed: %v", tb);
- g_string_free (tb, TRUE);
+ msg_err ("call to adm lua script failed (%d): %v", ret, tb);
+
+ if (tb) {
+ g_string_free (tb, TRUE);
+ }
+
lua_pop (L, 1);
return FALSE;