From 47b561775314d14f996b5224a16f7dc30179231a Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Fri, 2 Feb 2024 16:33:35 +0100 Subject: [PATCH] fix resetting modified_attributes resetting modified_attributes to zero had no effect. The reason was a wrong assumption when reading the retention file. The retained value was restored even if the correspondig modified_attributes was not set (anymore). Now we have the following attribute changes (assuming retention is enabled): - attribute was changed via gui -> retained on next reload - attribute was changed via gui but config value changed afterwards -> use the configured value instead of the retained one - config value changed and attribute has not been changed via gui -> use the configured value Signed-off-by: Sven Nierlein --- src/naemon/xrddefault.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/naemon/xrddefault.c b/src/naemon/xrddefault.c index 67db96ca..5d9823a5 100644 --- a/src/naemon/xrddefault.c +++ b/src/naemon/xrddefault.c @@ -470,8 +470,7 @@ int xrddefault_save_state_information(void) /******************************************************************/ #define RETAIN_BOOL(type, obj, v, attr) \ do { \ - if ((obj->modified_attributes & attr && !have.v) || (have.v && conf.v == obj->v)) { \ - printf("Retaining boolean " #v " for " #type " (%s) (conf.v = %d; have.v = %d)\n", val, conf.v, have.v); \ + if (obj->modified_attributes & attr && (!have.v || (have.v && conf.v == obj->v))) { \ pre_modify_##type##_attribute(obj, attr); \ obj->v = atoi(val) > 0 ? TRUE : FALSE; \ } \