MCPcopy Create free account
hub / github.com/containerd/cgroups / VerifyGroupPath

Function VerifyGroupPath

cgroup2/paths.go:49–60  ·  view source on GitHub ↗

VerifyGroupPath verifies the format of group path string g. The format is same as the third field in /proc/PID/cgroup. e.g. "/user.slice/user-1001.slice/session-1.scope" g must be a "clean" absolute path starts with "/", and must not contain "/sys/fs/cgroup" prefix. VerifyGroupPath doesn't verify

(g string)

Source from the content-addressed store, hash-verified

47//
48// VerifyGroupPath doesn't verify whether g actually exists on the system.
49func VerifyGroupPath(g string) error {
50 if !strings.HasPrefix(g, "/") {
51 return ErrInvalidGroupPath
52 }
53 if filepath.Clean(g) != g {
54 return ErrInvalidGroupPath
55 }
56 if strings.HasPrefix(g, "/sys/fs/cgroup") {
57 return ErrInvalidGroupPath
58 }
59 return nil
60}

Callers 3

NewManagerFunction · 0.85
LoadFunction · 0.85
TestVerifyGroupPathFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestVerifyGroupPathFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…