resolved: move resetting of {etc_hosts|static_records}_last to manager_dispatch_reload_signal()

This addresses
https://github.com/systemd/systemd/pull/41213#pullrequestreview-4002247053
which I somehow missed earlier.

Claude found a real issue for the case of manager_etc_hosts_flush().
We'll do the equivalent change in manager_static_records_flush() too,
even though it's not really necessary there, simply to keep things
nicely mirrored.
This commit is contained in:
Lennart Poettering
2026-03-25 23:06:03 +01:00
parent 7863f6ba85
commit b734340596
3 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -72,7 +72,8 @@ void etc_hosts_clear(EtcHosts *hosts) {
void manager_etc_hosts_flush(Manager *m) {
etc_hosts_clear(&m->etc_hosts);
m->etc_hosts_stat = (struct stat) {};
m->etc_hosts_last = USEC_INFINITY;
/* NB: We do not reset m->etc_hosts_last here, because manager_etc_hosts_read() calls us and needs it
* to stay in effect for the reload suppression to work */
}
static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
+3
View File
@@ -664,6 +664,9 @@ static int manager_dispatch_reload_signal(sd_event_source *s, const struct signa
manager_etc_hosts_flush(m);
manager_static_records_flush(m);
m->etc_hosts_last = USEC_INFINITY;
m->static_records_last = USEC_INFINITY;
manager_set_defaults(m);
r = dns_trust_anchor_load(&m->trust_anchor);
-1
View File
@@ -222,5 +222,4 @@ void manager_static_records_flush(Manager *m) {
m->static_records = hashmap_free(m->static_records);
m->static_records_stat = set_free(m->static_records_stat);
m->static_records_last = USEC_INFINITY;
}