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)
| 47 | // |
| 48 | // VerifyGroupPath doesn't verify whether g actually exists on the system. |
| 49 | func 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 | } |
no outgoing calls
searching dependent graphs…