Fix panic condition in cgroups.getAvailableControllers

Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
This commit is contained in:
zhangguanzhang committed 2021-06-15 09:22:37 +08:00
1 parent e549ca5078
commit fc9868e224
1 file changed
+2 -3
+2 -3
View File
@@ -165,14 +165,13 @@ func getAvailableControllers(exclude map[string]controllerHandler, cgroup2 bool)
if _, found := exclude[name]; found {
continue
}
isSymLink := false
fileInfo, err := os.Stat(cgroupRoot + "/" + name)
if err != nil {
isSymLink = !fileInfo.IsDir()
continue
}
c := controller{
name: name,
symlink: isSymLink,
symlink: !fileInfo.IsDir(),
}
controllers = append(controllers, c)
}