Skip to content

Commit

Permalink
Merge pull request #9656 from Nordix/kashif/fix-CNI-file-permission-o…
Browse files Browse the repository at this point in the history
…n-existing-files

Ensure existing CNI config file has correct permissions
  • Loading branch information
caseydavenport authored Jan 15, 2025
2 parents daeb5c3 + d9441a6 commit 8bafe5f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cni-plugin/pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,12 @@ func writeCNIConfig(c config) {
logrus.Fatal(err)
}

// Safeguarding since WriteFile does not change existing file's permissions.
err = os.Chmod(path, perm)
if err != nil {
logrus.Fatal(err)
}

content, err := os.ReadFile(path)
if err != nil {
logrus.Fatal(err)
Expand Down

0 comments on commit 8bafe5f

Please sign in to comment.