diff --git a/libcontainer/cgroups/fs/apply_raw.go b/libcontainer/cgroups/fs/apply_raw.go index 85bbf401bf6..815f08253be 100644 --- a/libcontainer/cgroups/fs/apply_raw.go +++ b/libcontainer/cgroups/fs/apply_raw.go @@ -235,12 +235,12 @@ func getCgroupData(c *configs.Cgroup, pid int) (*data, error) { }, nil } -func (raw *data) parent(subsystem, mountpoint, src string) (string, error) { +func (raw *data) parent(subsystem, mountpoint, root string) (string, error) { initPath, err := cgroups.GetThisCgroupDir(subsystem) if err != nil { return "", err } - relDir, err := filepath.Rel(src, initPath) + relDir, err := filepath.Rel(root, initPath) if err != nil { return "", err } @@ -248,7 +248,7 @@ func (raw *data) parent(subsystem, mountpoint, src string) (string, error) { } func (raw *data) path(subsystem string) (string, error) { - mnt, src, err := cgroups.FindCgroupMountpointAndSource(subsystem) + mnt, root, err := cgroups.FindCgroupMountpointAndRoot(subsystem) // If we didn't mount the subsystem, there is no point we make the path. if err != nil { return "", err @@ -259,7 +259,7 @@ func (raw *data) path(subsystem string) (string, error) { return filepath.Join(raw.root, filepath.Base(mnt), raw.cgroup), nil } - parent, err := raw.parent(subsystem, mnt, src) + parent, err := raw.parent(subsystem, mnt, root) if err != nil { return "", err } diff --git a/libcontainer/cgroups/utils.go b/libcontainer/cgroups/utils.go index fbec948c2a9..72a8c014083 100644 --- a/libcontainer/cgroups/utils.go +++ b/libcontainer/cgroups/utils.go @@ -47,7 +47,7 @@ func FindCgroupMountpoint(subsystem string) (string, error) { return "", NewNotFoundError(subsystem) } -func FindCgroupMountpointAndSource(subsystem string) (string, string, error) { +func FindCgroupMountpointAndRoot(subsystem string) (string, string, error) { f, err := os.Open("/proc/self/mountinfo") if err != nil { return "", "", err