diff options
author | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-06-30 15:48:20 +0200 |
---|---|---|
committer | Giuseppe Scrivano <gscrivan@redhat.com> | 2020-06-30 15:49:33 +0200 |
commit | f54408bf06e48ed125d791660d5d55fef913f433 (patch) | |
tree | 7bee35753ca714d32aacf4de39520cb5f6b9c24a /utils | |
parent | b163ec35d0d42423c274019cb41013d558d6f822 (diff) | |
download | podman-f54408bf06e48ed125d791660d5d55fef913f433.tar.gz podman-f54408bf06e48ed125d791660d5d55fef913f433.tar.bz2 podman-f54408bf06e48ed125d791660d5d55fef913f433.zip |
utils: fix parsing of cgroup with : in the name
a cgroup can have ':' in its name. Make sure the parser doesn't split
more than 3 fields and leave untouched the ':' in the cgroup name.
commit 6ee5f740a4ecb70636b888e78b02065ee984636c introduced the issue.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utils_supported.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/utils/utils_supported.go b/utils/utils_supported.go index 201ddb57b..4258e6d7a 100644 --- a/utils/utils_supported.go +++ b/utils/utils_supported.go @@ -64,7 +64,7 @@ func getCgroupProcess(procFile string) (string, error) { cgroup := "/" for scanner.Scan() { line := scanner.Text() - parts := strings.Split(line, ":") + parts := strings.SplitN(line, ":", 3) if len(parts) != 3 { return "", errors.Errorf("cannot parse cgroup line %q", line) } @@ -116,7 +116,7 @@ func MoveUnderCgroupSubtree(subtree string) error { scanner := bufio.NewScanner(f) for scanner.Scan() { line := scanner.Text() - parts := strings.Split(line, ":") + parts := strings.SplitN(line, ":", 3) if len(parts) != 3 { return errors.Errorf("cannot parse cgroup line %q", line) } |