mirror of
https://github.com/containers/skopeo.git
synced 2025-08-12 03:42:14 +00:00
Merge pull request #1968 from mtrmac/NewPid2
Avoid use of a deprecated capability.NewPid
This commit is contained in:
commit
9ffdceb157
@ -22,10 +22,13 @@ func maybeReexec() error {
|
|||||||
// With Skopeo we need only the subset of the root capabilities necessary
|
// With Skopeo we need only the subset of the root capabilities necessary
|
||||||
// for pulling an image to the storage. Do not attempt to create a namespace
|
// for pulling an image to the storage. Do not attempt to create a namespace
|
||||||
// if we already have the capabilities we need.
|
// if we already have the capabilities we need.
|
||||||
capabilities, err := capability.NewPid(0)
|
capabilities, err := capability.NewPid2(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error reading the current capabilities sets: %w", err)
|
return fmt.Errorf("error reading the current capabilities sets: %w", err)
|
||||||
}
|
}
|
||||||
|
if err := capabilities.Load(); err != nil {
|
||||||
|
return fmt.Errorf("error loading the current capabilities sets: %w", err)
|
||||||
|
}
|
||||||
if slices.ContainsFunc(neededCapabilities, func(cap capability.Cap) bool {
|
if slices.ContainsFunc(neededCapabilities, func(cap capability.Cap) bool {
|
||||||
return !capabilities.Get(capability.EFFECTIVE, cap)
|
return !capabilities.Get(capability.EFFECTIVE, cap)
|
||||||
}) {
|
}) {
|
||||||
|
Loading…
Reference in New Issue
Block a user