mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #182 from mrjana/cnm_integ
Fix /etc/resolv.conf permission issue
This commit is contained in:
commit
36294e8253
2 changed files with 15 additions and 0 deletions
|
@ -548,6 +548,11 @@ func (ep *endpoint) updateDNS(resolvConf []byte) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Change the perms to 0644 since ioutil.TempFile creates it by default as 0600
|
||||
if err := os.Chmod(tmpResolvFile.Name(), 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// write the updates to the temp files
|
||||
if err = ioutil.WriteFile(tmpHashFile.Name(), []byte(newHash), 0644); err != nil {
|
||||
return err
|
||||
|
|
|
@ -1137,6 +1137,16 @@ func TestResolvConf(t *testing.T) {
|
|||
}
|
||||
}()
|
||||
|
||||
finfo, err := os.Stat(resolvConfPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
fmode := (os.FileMode)(0644)
|
||||
if finfo.Mode() != fmode {
|
||||
t.Fatalf("Expected file mode %s, got %s", fmode.String(), finfo.Mode().String())
|
||||
}
|
||||
|
||||
content, err := ioutil.ReadFile(resolvConfPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
Loading…
Add table
Reference in a new issue