mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-27 10:47:35 +00:00
net/dns: retry overwriting hosts file on Windows
Updates #5753 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I60f81bd3325d5ba5383b947c7a7aaa5b14e460f6
This commit is contained in:
parent
3a5d02cb31
commit
ec790e58df
@ -167,7 +167,16 @@ func (m *windowsManager) setHosts(hosts []*HostEntry) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
const fileMode = 0 // ignored on windows.
|
const fileMode = 0 // ignored on windows.
|
||||||
return atomicfile.WriteFile(hostsFile, outB, fileMode)
|
|
||||||
|
// This can fail spuriously with an access denied error, so retry it a
|
||||||
|
// few times.
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
if err = atomicfile.WriteFile(hostsFile, outB, fileMode); err == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
time.Sleep(10 * time.Millisecond)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// setPrimaryDNS sets the given resolvers and domains as the Tailscale
|
// setPrimaryDNS sets the given resolvers and domains as the Tailscale
|
||||||
|
Loading…
x
Reference in New Issue
Block a user