cgroups/fs2: do not use securejoin

In this very case, the code is writing to cgroup2 filesystem,
and the file name is well known and can't possibly be a symlink.
So, using securejoin is redundant.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2020-04-03 19:19:39 -07:00
parent bf0a8e1747
commit 353e91770b
1 changed files with 1 additions and 5 deletions

View File

@ -8,7 +8,6 @@ import (
"path/filepath"
"strings"
securejoin "github.com/cyphar/filepath-securejoin"
"github.com/opencontainers/runc/libcontainer/cgroups"
"github.com/opencontainers/runc/libcontainer/configs"
"github.com/pkg/errors"
@ -50,10 +49,7 @@ func detectControllers(dirPath string) (map[string]struct{}, error) {
if err := os.MkdirAll(dirPath, 0755); err != nil {
return nil, err
}
controllersPath, err := securejoin.SecureJoin(dirPath, "cgroup.controllers")
if err != nil {
return nil, err
}
controllersPath := filepath.Join(dirPath, "cgroup.controllers")
controllersData, err := ioutil.ReadFile(controllersPath)
if err != nil {
return nil, err