Skip to content

Commit

Permalink
Ensure existing CNI config file has correct permissions
Browse files Browse the repository at this point in the history
Signed-off-by: Kashif Khan <[email protected]>
  • Loading branch information
kashifest committed Dec 31, 2024
1 parent 39b473a commit 3bebbba
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 3bebbba

Please sign in to comment.