summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-18 10:58:06 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-18 10:58:26 +0100
commit83bcd87dd41bb19917e2cd23e14bf5fef16fbe22 (patch)
tree6d1051fddf510a3229b06a7f6f31830379199b53
parent42638d5b5ff5f5a7d08b318261f0421d1f6b0e36 (diff)
downloadrspamd-83bcd87dd41bb19917e2cd23e14bf5fef16fbe22.tar.gz
rspamd-83bcd87dd41bb19917e2cd23e14bf5fef16fbe22.zip
[Minor] Load language detector from the config
-rw-r--r--src/libserver/cfg_rcl.c10
-rw-r--r--src/libserver/task.c6
2 files changed, 13 insertions, 3 deletions
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 20d51b31c..174b4af5e 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -3449,9 +3449,11 @@ rspamd_config_parse_ucl (struct rspamd_config *cfg, const gchar *filename,
}
if (!ucl_parser_add_chunk (parser, data, st.st_size)) {
- msg_err_config_forced ("ucl parser error: %s", ucl_parser_get_error (parser));
+ g_set_error (err, cfg_rcl_error_quark (), errno,
+ "ucl parser error: %s", ucl_parser_get_error (parser));
ucl_parser_free (parser);
munmap (data, st.st_size);
+
return FALSE;
}
@@ -3517,7 +3519,11 @@ rspamd_config_read (struct rspamd_config *cfg, const gchar *filename,
if (!rspamd_rcl_parse (top, cfg, cfg, cfg->cfg_pool, cfg->rcl_obj, &err)) {
msg_err_config ("rcl parse error: %e", err);
- g_error_free (err);
+
+ if (err) {
+ g_error_free (err);
+ }
+
return FALSE;
}
diff --git a/src/libserver/task.c b/src/libserver/task.c
index 9801212f1..8994214a5 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -69,6 +69,7 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
new_task = g_malloc0 (sizeof (struct rspamd_task));
new_task->worker = worker;
+ new_task->lang_det = lang_det;
if (cfg) {
new_task->cfg = cfg;
@@ -79,6 +80,10 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
}
new_task->re_rt = rspamd_re_cache_runtime_new (cfg->re_cache);
+
+ if (new_task->lang_det == NULL && cfg->lang_det != NULL) {
+ new_task->lang_det = cfg->lang_det;
+ }
}
gettimeofday (&new_task->tv, NULL);
@@ -86,7 +91,6 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg,
new_task->time_virtual = rspamd_get_virtual_ticks ();
new_task->time_real_finish = NAN;
new_task->time_virtual_finish = NAN;
- new_task->lang_det = lang_det;
if (pool == NULL) {
new_task->task_pool =