mirror of
https://github.com/containers/podman.git
synced 2025-06-24 03:08:13 +08:00
Merge pull request #14147 from ttys3/Container.cGroupPath-Error-parsing-cgroup
fix: Container.cGroupPath() skip empty line to avoid false error logging
This commit is contained in:
@ -994,6 +994,10 @@ func (c *Container) cGroupPath() (string, error) {
|
|||||||
|
|
||||||
var cgroupPath string
|
var cgroupPath string
|
||||||
for _, line := range bytes.Split(lines, []byte("\n")) {
|
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
|
// cgroups(7) nails it down to three fields with the 3rd
|
||||||
// pointing to the cgroup's path which works both on v1 and v2.
|
// pointing to the cgroup's path which works both on v1 and v2.
|
||||||
fields := bytes.Split(line, []byte(":"))
|
fields := bytes.Split(line, []byte(":"))
|
||||||
|
Reference in New Issue
Block a user