fix: Container.cGroupPath() skip empty line to avoid false error logging

Signed-off-by: ttyS3 <ttys3.rust@gmail.com>

[NO NEW TESTS NEEDED]
This commit is contained in:
ttyS3
2022-05-08 01:25:48 +08:00
parent 21c816bb16
commit be5abf03ab

View File

@ -994,6 +994,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(":"))