systemd-resolved: checkUnknownPaths knows exactly its own files (review r2 (4))

It treated the verb's own uplink-names.new as unknown and accepted any
bare *.tmp; it now knows exactly uplink-names, uplink-names.new,
uplink-names.applied and uplink-names.applied.tmp, as §6 and §8 name
them, and nothing else.

Builds: design 08 sign-in-page §6, §8, C-7
This commit is contained in:
jochen
2026-11-25 01:17:26 +01:00
parent a74afe71f3
commit 8f86aedeae
2 changed files with 30 additions and 3 deletions
@@ -571,13 +571,18 @@ func (g *Guard) checkUnknownPaths() {
if err != nil {
return
}
// Exactly what this module writes there (review r2 (4)): the names file and the one §6 writes it
// beside (uplink-names, uplink-names.new), the applied record and the one it is written beside (§8:
// uplink-names.applied, uplink-names.applied.tmp). Nothing else, a bare *.tmp included.
known := map[string]bool{
filepath.Base(g.Resolver.UplinkNamesFile): true,
filepath.Base(g.Resolver.UplinkNamesAppliedFile): true,
filepath.Base(g.Resolver.UplinkNamesFile): true,
filepath.Base(g.Resolver.UplinkNamesFile) + ".new": true,
filepath.Base(g.Resolver.UplinkNamesAppliedFile): true,
filepath.Base(g.Resolver.UplinkNamesAppliedFile) + ".tmp": true,
}
for _, e := range entries {
name := e.Name()
if known[name] || strings.HasSuffix(name, ".tmp") || g.unknownSaid[name] {
if known[name] || g.unknownSaid[name] {
continue
}
if g.unknownSaid == nil {