diff options
author | ttyS3 <ttys3.rust@gmail.com> | 2022-05-08 01:25:48 +0800 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2022-06-14 13:11:47 -0400 |
commit | 42e70a0c9477ffd4e6f5129f8b50be43de216188 (patch) | |
tree | 307a59ee5a4d7b2ba22bdbe3f9e7ad471404f5e9 | |
parent | 4cc2ce089827ef7dee3393c477ef1afd79ffa442 (diff) | |
download | podman-42e70a0c9477ffd4e6f5129f8b50be43de216188.tar.gz podman-42e70a0c9477ffd4e6f5129f8b50be43de216188.tar.bz2 podman-42e70a0c9477ffd4e6f5129f8b50be43de216188.zip |
fix: Container.cGroupPath() skip empty line to avoid false error logging
Signed-off-by: ttyS3 <ttys3.rust@gmail.com>
[NO NEW TESTS NEEDED]
-rw-r--r-- | libpod/container.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libpod/container.go b/libpod/container.go index 457b290b7..df7c6b219 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -986,6 +986,10 @@ func (c *Container) cGroupPath() (string, error) { var cgroupPath string for _, line := range bytes.Split(lines, []byte("\n")) { + // skip last empty line + if len(line) == 0 { + continue + } // cgroups(7) nails it down to three fields with the 3rd // pointing to the cgroup's path which works both on v1 and v2. fields := bytes.Split(line, []byte(":")) |