diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-01-15 12:24:25 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2022-01-15 12:24:25 +0000 |
commit | b3073d94bdcfabc37aeb27678c996a554c9f1df7 (patch) | |
tree | 8e75181e6b8b1ecb5a0039a040889e4296505631 /src/libserver/rspamd_symcache.c | |
parent | 0956f41e2385dbd908bf383a41541bf263789349 (diff) | |
download | rspamd-b3073d94bdcfabc37aeb27678c996a554c9f1df7.tar.gz rspamd-b3073d94bdcfabc37aeb27678c996a554c9f1df7.zip |
[Minor] Deal with unknown weight more carefully to avoid special meaning of 0
The special unknown weight must be NAN not 0.0
Diffstat (limited to 'src/libserver/rspamd_symcache.c')
-rw-r--r-- | src/libserver/rspamd_symcache.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c index d1fb68672..4335ada68 100644 --- a/src/libserver/rspamd_symcache.c +++ b/src/libserver/rspamd_symcache.c @@ -1438,7 +1438,7 @@ rspamd_symcache_validate_cb (gpointer k, gpointer v, gpointer ud) (SYMBOL_TYPE_NORMAL|SYMBOL_TYPE_VIRTUAL|SYMBOL_TYPE_COMPOSITE|SYMBOL_TYPE_CLASSIFIER)) && g_hash_table_lookup (cfg->symbols, item->symbol) == NULL) { - if (cfg->unknown_weight != 0) { + if (!isnan(cfg->unknown_weight)) { skipped = FALSE; item->st->weight = cfg->unknown_weight; @@ -1448,7 +1448,8 @@ rspamd_symcache_validate_cb (gpointer k, gpointer v, gpointer ud) s->weight_ptr = &item->st->weight; g_hash_table_insert (cfg->symbols, item->symbol, s); - msg_info_cache ("adding unknown symbol %s", item->symbol); + msg_info_cache ("adding unknown symbol %s with weight: %.2f", + item->symbol, cfg->unknown_weight); ghost = FALSE; } else { |