summaryrefslogtreecommitdiff
path: root/pkg/resolvconf/resolvconf.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-02-03 09:37:20 -0500
committerGitHub <noreply@github.com>2022-02-03 09:37:20 -0500
commit08930b24b98b31ea4f1ce882a45166b469b28ced (patch)
treeb76b51e25d16a1a36bf57a3647fe7216da1e6c84 /pkg/resolvconf/resolvconf.go
parent51cc0edfee817d3cd6498b2251ee7debe3647912 (diff)
parent25e073492f266062f47c65bb20e590b023422746 (diff)
downloadpodman-08930b24b98b31ea4f1ce882a45166b469b28ced.tar.gz
podman-08930b24b98b31ea4f1ce882a45166b469b28ced.tar.bz2
podman-08930b24b98b31ea4f1ce882a45166b469b28ced.zip
Merge pull request #13117 from Luap99/resolv
Revert "Move each search dns to its own line"
Diffstat (limited to 'pkg/resolvconf/resolvconf.go')
-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 {