diff options
author | Thierry Fournier <thierry.fournier@ozon.io> | 2020-03-07 10:57:10 +0100 |
---|---|---|
committer | Thierry Fournier <thierry.fournier@ozon.io> | 2020-03-07 11:04:41 +0100 |
commit | 6d651a8d0944fd5ccba04fca35fe3555d1c8cd4f (patch) | |
tree | 7ba5b0dc994c32398279df4527c43b9343388f8f | |
parent | 569cb5e7571f8b4f74613877aa59190d8ef86e12 (diff) | |
download | rspamd-6d651a8d0944fd5ccba04fca35fe3555d1c8cd4f.tar.gz rspamd-6d651a8d0944fd5ccba04fca35fe3555d1c8cd4f.zip |
[Minor] --var doesn't work
We can add varaibels on the command line after argument or using --var parameter.
When --var is used, an assertion is triggered:
./rspamd.install/bin/rspamd --var LOGDIR=/tmp/
(rspamd:7171): GLib-CRITICAL **: g_hash_table_insert_internal: assertion 'hash_table != NULL' failed
The hash table is not initialized, because the table is initialized after
the argument parser.
This patch initialize the hash table on demand.
Note: the patch is tested on 1.9 version and not on master, because I can't compile the master branch.
Note: I suggest to backport the patch on 1.9 version
-rw-r--r-- | src/rspamd.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rspamd.c b/src/rspamd.c index 6fbb64fdf..12f0cae2c 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -148,6 +148,11 @@ rspamd_parse_var (const gchar *option_name, v = g_strdup (t + 1); *t = '\0'; + if (ucl_vars == NULL) { + ucl_vars = g_hash_table_new_full (rspamd_strcase_hash, + rspamd_strcase_equal, g_free, g_free); + } + g_hash_table_insert (ucl_vars, k, v); } else { |