Skip to content

Commit 2a9114d

Browse files
authored
Merge pull request containernetworking#665 from edef1c/filepath-clean
Don't redundantly filepath.Clean the output of filepath.Join
2 parents 2c46a72 + ceb34eb commit 2a9114d

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

pkg/utils/sysctl/sysctl_linux.go

-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func Sysctl(name string, params ...string) (string, error) {
3636

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

4847
func setSysctl(name, value string) (string, error) {
4948
fullName := filepath.Join("/proc/sys", toNormalName(name))
50-
fullName = filepath.Clean(fullName)
5149
if err := ioutil.WriteFile(fullName, []byte(value), 0644); err != nil {
5250
return "", err
5351
}

plugins/meta/tuning/tuning.go

-2
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ func cmdAdd(args *skel.CmdArgs) error {
326326
err = ns.WithNetNSPath(args.Netns, func(_ ns.NetNS) error {
327327
for key, value := range tuningConf.SysCtl {
328328
fileName := filepath.Join("/proc/sys", strings.Replace(key, ".", "/", -1))
329-
fileName = filepath.Clean(fileName)
330329

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

433431
contents, err := ioutil.ReadFile(fileName)
434432
if err != nil {

0 commit comments

Comments
 (0)