summaryrefslogtreecommitdiff
path: root/pkg/resolvconf
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-02-02 18:42:35 +0100
committerPaul Holzinger <pholzing@redhat.com>2022-02-02 19:33:21 +0100
commit25e073492f266062f47c65bb20e590b023422746 (patch)
tree762816b7c5c3077641f7b7f93abfc95ef51711e4 /pkg/resolvconf
parent21a8ee904465b1aa54ce5fa6e3bbf93519ca0442 (diff)
downloadpodman-25e073492f266062f47c65bb20e590b023422746.tar.gz
podman-25e073492f266062f47c65bb20e590b023422746.tar.bz2
podman-25e073492f266062f47c65bb20e590b023422746.zip
Revert "Move each search dns to its own line"
This reverts commit a1bc8cb52cefd49e8cc54ae14d1864b8a1ec216e. Please see resolv.conf(5) search domains must be on the same line. If you use multiple seach key words only the last one is used. I tested this with alpine and it works correctly when they are on the same line so I am not sure what issues Dan had with it but this is not correct. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg/resolvconf')
-rw-r--r--pkg/resolvconf/resolvconf.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/resolvconf/resolvconf.go b/pkg/resolvconf/resolvconf.go
index d7505e049..f23cd61b0 100644
--- a/pkg/resolvconf/resolvconf.go
+++ b/pkg/resolvconf/resolvconf.go
@@ -221,9 +221,11 @@ func GetOptions(resolvConf []byte) []string {
// dnsSearch, and an "options" entry for every element in dnsOptions.
func Build(path string, dns, dnsSearch, dnsOptions []string) (*File, error) {
content := bytes.NewBuffer(nil)
- for _, search := range dnsSearch {
- if _, err := content.WriteString("search " + search + "\n"); err != nil {
- return nil, err
+ if len(dnsSearch) > 0 {
+ if searchString := strings.Join(dnsSearch, " "); strings.Trim(searchString, " ") != "." {
+ if _, err := content.WriteString("search " + searchString + "\n"); err != nil {
+ return nil, err
+ }
}
}
for _, dns := range dns {