Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
network: ensure parent directories exist
Browse files Browse the repository at this point in the history
make sure the parent directory exists when opening the resolv.conf
file.

fixes: #669

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Oct 17, 2019
1 parent b90fe28 commit 7a7dba7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"fmt"
"net"
"os"
"path/filepath"
"reflect"
"strings"
"sync"
Expand Down Expand Up @@ -619,6 +620,10 @@ func setupDNS(dns []string) (err error) {
agentLog.Debug("Did not set sandbox DNS as DNS not received as part of grpc request.")
return nil
}

if err := os.MkdirAll(filepath.Dir(kataGuestSandboxDNSFile), 0700); err != nil {
return err
}
if file, err = os.Create(kataGuestSandboxDNSFile); err != nil {
return err
}
Expand Down

0 comments on commit 7a7dba7

Please sign in to comment.