From c27aa9e7ff6d906cacfa5e1f5a583e4dabf4eb1e Mon Sep 17 00:00:00 2001 From: Juergen Knaack Date: Sat, 25 Nov 2023 15:25:56 +0100 Subject: [PATCH] net/dns: fix darwin dns resolver files putting each nameserver on one line in /etc/resolver/ fixes: #10134 Signed-off-by: Juergen Knaack --- net/dns/manager_darwin.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/net/dns/manager_darwin.go b/net/dns/manager_darwin.go index 2571cf8de..1f0887c71 100644 --- a/net/dns/manager_darwin.go +++ b/net/dns/manager_darwin.go @@ -36,15 +36,11 @@ func (c *darwinConfigurator) SupportsSplitDNS() bool { func (c *darwinConfigurator) SetDNS(cfg OSConfig) error { var buf bytes.Buffer buf.WriteString(macResolverFileHeader) - for i, ip := range cfg.Nameservers { - if i == 0 { - buf.WriteString("nameserver ") - } else { - buf.WriteString(" ") - } + for _, ip := range cfg.Nameservers { + buf.WriteString("nameserver ") buf.WriteString(ip.String()) + buf.WriteString("\n") } - buf.WriteString("\n") if err := os.MkdirAll("/etc/resolver", 0755); err != nil { return err