Fix panic condition in cgroups.getAvailableControllers

Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
This commit is contained in:
zhangguanzhang
2021-06-13 20:32:43 +08:00
parent e549ca5078
commit fc9868e224

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)
} }