From e76ac1c05493fcd2c3a89996675a7c0b792de52c Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 22 Sep 2020 19:50:36 -0700 Subject: [PATCH] libct/cg/fscommon.GetCgroupParamString: use ReadFile 1. Use own ReadFile wrapper instead of ioutils.ReadFile. This makes it use the security measures of ReadFile. 2. Improve doc. Signed-off-by: Kir Kolyshkin --- libcontainer/cgroups/fscommon/utils.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcontainer/cgroups/fscommon/utils.go b/libcontainer/cgroups/fscommon/utils.go index 236c75a07..99c31bb4a 100644 --- a/libcontainer/cgroups/fscommon/utils.go +++ b/libcontainer/cgroups/fscommon/utils.go @@ -73,9 +73,9 @@ func GetCgroupParamUint(cgroupPath, cgroupFile string) (uint64, error) { return res, nil } -// Gets a string value from the specified cgroup file -func GetCgroupParamString(cgroupPath, cgroupFile string) (string, error) { - contents, err := ioutil.ReadFile(filepath.Join(cgroupPath, cgroupFile)) +// GetCgroupParamString reads a string from the specified cgroup file. +func GetCgroupParamString(path, file string) (string, error) { + contents, err := ReadFile(path, file) if err != nil { return "", err }