]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: move resetting of {etc_hosts|static_records}_last to manager_dispatch_reloa... 41337/head
authorLennart Poettering <lennart@amutable.com>
Wed, 25 Mar 2026 21:18:12 +0000 (22:18 +0100)
committerLennart Poettering <lennart@amutable.com>
Wed, 25 Mar 2026 22:06:03 +0000 (23:06 +0100)
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.

src/resolve/resolved-etc-hosts.c
src/resolve/resolved-manager.c
src/resolve/resolved-static-records.c

index 00c76a9977f85daa1357780c6ab0202bd4e1a379..b38c011e7c6e7ed8fdc9d4774f6426636142725b 100644 (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) {
index 25a51ed02b0423efd1b59b1b132e4beed7bf637e..e96ae4393c682072cd0d755f620d286523842f70 100644 (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);
index 0f2d09b324fb1d93c65ee67241cd81053a6b2722..d905d507d6ab37ba5ba1e02e79f73bdb43ae00c0 100644 (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;
 }