aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstat/backends/sqlite3_backend.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-02-12 14:54:43 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-02-12 15:57:33 +0000
commitaa26e139bad1744a36d3878804e22116f90afafb (patch)
treef57503c2c5c6b5e2fd5f0a44c945cddec07a6b13 /src/libstat/backends/sqlite3_backend.c
parentf6dcd96b784a68846666cfa4de060446c9c11983 (diff)
downloadrspamd-aa26e139bad1744a36d3878804e22116f90afafb.tar.gz
rspamd-aa26e139bad1744a36d3878804e22116f90afafb.zip
[Fix] Propagate learn/stat errors more precisely
Diffstat (limited to 'src/libstat/backends/sqlite3_backend.c')
-rw-r--r--src/libstat/backends/sqlite3_backend.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c
index 8682ca73f..78c22f7de 100644
--- a/src/libstat/backends/sqlite3_backend.c
+++ b/src/libstat/backends/sqlite3_backend.c
@@ -735,7 +735,7 @@ rspamd_sqlite3_process_tokens (struct rspamd_task *task,
return TRUE;
}
-void
+gboolean
rspamd_sqlite3_finalize_process (struct rspamd_task *task, gpointer runtime,
gpointer ctx)
{
@@ -754,7 +754,7 @@ rspamd_sqlite3_finalize_process (struct rspamd_task *task, gpointer runtime,
rt->lang_id = -1;
rt->user_id = -1;
- return;
+ return TRUE;
}
gboolean
@@ -819,9 +819,9 @@ rspamd_sqlite3_learn_tokens (struct rspamd_task *task, GPtrArray *tokens,
return TRUE;
}
-void
+gboolean
rspamd_sqlite3_finalize_learn (struct rspamd_task *task, gpointer runtime,
- gpointer ctx)
+ gpointer ctx, GError **err)
{
struct rspamd_stat_sqlite3_rt *rt = runtime;
struct rspamd_stat_sqlite3_db *bk;
@@ -852,8 +852,15 @@ rspamd_sqlite3_finalize_learn (struct rspamd_task *task, gpointer runtime,
&wal_checkpointed) != SQLITE_OK) {
msg_warn_task ("cannot commit checkpoint: %s",
sqlite3_errmsg (bk->sqlite));
+
+ g_set_error (err, rspamd_sqlite3_backend_quark (), 500,
+ "cannot commit checkpoint: %s",
+ sqlite3_errmsg (bk->sqlite));
+ return FALSE;
}
#endif
+
+ return TRUE;
}
gulong