mirror of
https://github.com/containers/podman.git
synced 2025-10-13 09:15:20 +08:00
Refactor: replace StringInSlice with slices.Contains
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
This commit is contained in:
@ -16,13 +16,13 @@ import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/containers/common/pkg/util"
|
||||
"github.com/containers/podman/v4/libpod/define"
|
||||
"github.com/containers/podman/v4/pkg/rootless"
|
||||
"github.com/containers/psgo"
|
||||
"github.com/containers/storage/pkg/reexec"
|
||||
"github.com/google/shlex"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/exp/slices"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
@ -231,7 +231,7 @@ func (c *Container) Top(descriptors []string) ([]string, error) {
|
||||
// Only use ps(1) from the host when we know the container was not started with CAP_SYS_PTRACE,
|
||||
// with it the container can access /proc/$pid/ files and potentially escape the container fs.
|
||||
if c.config.Spec.Process.Capabilities != nil &&
|
||||
!util.StringInSlice("CAP_SYS_PTRACE", c.config.Spec.Process.Capabilities.Effective) {
|
||||
!slices.Contains(c.config.Spec.Process.Capabilities.Effective, "CAP_SYS_PTRACE") {
|
||||
var retry bool
|
||||
output, retry, err = c.execPS(psDescriptors)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user