commit c0bcfaf: [Minor] Allow to adjust symbols without score change

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Apr 17 09:28:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-04-17 10:16:36 +0100
URL: https://github.com/rspamd/rspamd/commit/c0bcfaff59f0442c63ca6530fdabfb684edef1d3

[Minor] Allow to adjust symbols without score change

---
 src/lua/lua_task.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 4f92bdb06..3ad1aa3db 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2003,9 +2003,11 @@ lua_task_adjust_result (lua_State * L)
 		}
 
 		if (s) {
-			metric_res->score -= s->score;
-			s->score = weight;
-			metric_res->score += s->score;
+			if (!isnan (weight)) {
+				metric_res->score -= s->score;
+				s->score = weight;
+				metric_res->score += s->score;
+			}
 		}
 		else {
 			return luaL_error (L, "symbol not found: %s", symbol_name);


More information about the Commits mailing list