Skip to content

Commit ecf7430

Browse files
committed
libct/cg/fscommon: GetCgroupParam*: unify
1. GetCgroupParamUint: drop strings.TrimSpace since it was already done by GetCgroupParamString. 2. GetCgroupParamInt: use GetCgroupParamString, drop strings.TrimSpace. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent ef983f5 commit ecf7430

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

libcontainer/cgroups/fscommon/utils.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ func GetCgroupParamUint(path, file string) (uint64, error) {
104104
if err != nil {
105105
return 0, err
106106
}
107-
contents = strings.TrimSpace(contents)
108107
if contents == "max" {
109108
return math.MaxUint64, nil
110109
}
@@ -119,11 +118,10 @@ func GetCgroupParamUint(path, file string) (uint64, error) {
119118
// GetCgroupParamInt reads a single int64 value from specified cgroup file.
120119
// If the value read is "max", the math.MaxInt64 is returned.
121120
func GetCgroupParamInt(path, file string) (int64, error) {
122-
contents, err := cgroups.ReadFile(path, file)
121+
contents, err := GetCgroupParamString(path, file)
123122
if err != nil {
124123
return 0, err
125124
}
126-
contents = strings.TrimSpace(contents)
127125
if contents == "max" {
128126
return math.MaxInt64, nil
129127
}

0 commit comments

Comments
 (0)