Skip to content

Commit

Permalink
Merge pull request containernetworking#665 from edef1c/filepath-clean
Browse files Browse the repository at this point in the history
Don't redundantly filepath.Clean the output of filepath.Join
  • Loading branch information
dcbw authored Sep 29, 2021
2 parents 2c46a72 + ceb34eb commit 2a9114d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions pkg/utils/sysctl/sysctl_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func Sysctl(name string, params ...string) (string, error) {

func getSysctl(name string) (string, error) {
fullName := filepath.Join("/proc/sys", toNormalName(name))
fullName = filepath.Clean(fullName)
data, err := ioutil.ReadFile(fullName)
if err != nil {
return "", err
Expand All @@ -47,7 +46,6 @@ func getSysctl(name string) (string, error) {

func setSysctl(name, value string) (string, error) {
fullName := filepath.Join("/proc/sys", toNormalName(name))
fullName = filepath.Clean(fullName)
if err := ioutil.WriteFile(fullName, []byte(value), 0644); err != nil {
return "", err
}
Expand Down
2 changes: 0 additions & 2 deletions plugins/meta/tuning/tuning.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ func cmdAdd(args *skel.CmdArgs) error {
err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
for key, value := range tuningConf.SysCtl {
fileName := filepath.Join("/proc/sys", strings.Replace(key, ".", "/", -1))
fileName = filepath.Clean(fileName)

// Refuse to modify sysctl parameters that don't belong
// to the network subsystem.
Expand Down Expand Up @@ -428,7 +427,6 @@ func cmdCheck(args *skel.CmdArgs) error {
// Check each configured value vs what's currently in the container
for key, confValue := range tuningConf.SysCtl {
fileName := filepath.Join("/proc/sys", strings.Replace(key, ".", "/", -1))
fileName = filepath.Clean(fileName)

contents, err := ioutil.ReadFile(fileName)
if err != nil {
Expand Down

0 comments on commit 2a9114d

Please sign in to comment.