diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-29 14:08:14 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-01-29 14:08:14 +0000 |
commit | c6af76b620742ac7c9075c4d1226895aa49842f8 (patch) | |
tree | a3c59c182a84bc35ccbb38836f18c6fcce888be3 /src/cfg_rcl.c | |
parent | b380b5aaccc82b16f1db3172a51cb6e999f235fd (diff) | |
download | rspamd-c6af76b620742ac7c9075c4d1226895aa49842f8.tar.gz rspamd-c6af76b620742ac7c9075c4d1226895aa49842f8.zip |
Fix overrides for a metric.
Fixes #33
Diffstat (limited to 'src/cfg_rcl.c')
-rw-r--r-- | src/cfg_rcl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cfg_rcl.c b/src/cfg_rcl.c index 0301d475f..aedee7ea3 100644 --- a/src/cfg_rcl.c +++ b/src/cfg_rcl.c @@ -365,7 +365,7 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj, } } } - if (!have_actions) { + if (new && !have_actions) { g_set_error (err, CFG_RCL_ERROR, EINVAL, "metric %s has no actions", metric_name); return FALSE; } @@ -405,7 +405,7 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj, } } } - else { + else if (new) { g_set_error (err, CFG_RCL_ERROR, EINVAL, "metric %s has no symbols", metric_name); return FALSE; } @@ -422,8 +422,10 @@ rspamd_rcl_metric_handler (struct config_file *cfg, ucl_object_t *obj, } /* Insert the resulting metric */ - g_hash_table_insert (cfg->metrics, (void *)metric->name, metric); - cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric); + if (new) { + g_hash_table_insert (cfg->metrics, (void *)metric->name, metric); + cfg->metrics_list = g_list_prepend (cfg->metrics_list, metric); + } return TRUE; } |