Merge pull request #10668 from zhangguanzhang/panic-cgroup

[NO TESTS NEEDED] Fixes panic condition in cgroups.getAvailableControllers
This commit is contained in:
OpenShift Merge Robot
2021-06-15 09:29:33 -04:00
committed by GitHub

View File

@ -165,14 +165,13 @@ func getAvailableControllers(exclude map[string]controllerHandler, cgroup2 bool)
if _, found := exclude[name]; found { if _, found := exclude[name]; found {
continue continue
} }
isSymLink := false
fileInfo, err := os.Stat(cgroupRoot + "/" + name) fileInfo, err := os.Stat(cgroupRoot + "/" + name)
if err != nil { if err != nil {
isSymLink = !fileInfo.IsDir() continue
} }
c := controller{ c := controller{
name: name, name: name,
symlink: isSymLink, symlink: !fileInfo.IsDir(),
} }
controllers = append(controllers, c) controllers = append(controllers, c)
} }