cmd/cli: remove old DNS settings on installing

This commit is contained in:
Cuong Manh Le
2024-02-27 22:36:31 +07:00
committed by Cuong Manh Le
parent 9319d08046
commit 73a697b2fa

View File

@@ -739,6 +739,7 @@ func saveCurrentStaticDNS(iface *net.Interface) error {
file := savedStaticDnsSettingsFilePath(iface)
ns, _ := currentStaticDNS(iface)
if len(ns) == 0 {
_ = os.Remove(file) // removing old static DNS settings
return nil
}
if err := os.Remove(file); err != nil && !errors.Is(err, fs.ErrNotExist) {