Skip to content

Commit

Permalink
fix resetting modified_attributes
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sni committed Feb 5, 2024
1 parent 70666aa commit 47b5617
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/naemon/xrddefault.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
} \
Expand Down

0 comments on commit 47b5617

Please sign in to comment.