Skip to content

Commit

Permalink
Merge pull request containers#1968 from mtrmac/NewPid2
Browse files Browse the repository at this point in the history
Avoid use of a deprecated capability.NewPid
  • Loading branch information
mtrmac authored Apr 6, 2023
2 parents 1e70fee + 4f5e821 commit 9ffdceb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/skopeo/unshare_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ func maybeReexec() error {
// 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
// if we already have the capabilities we need.
capabilities, err := capability.NewPid(0)
capabilities, err := capability.NewPid2(0)
if err != nil {
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 {
return !capabilities.Get(capability.EFFECTIVE, cap)
}) {
Expand Down

0 comments on commit 9ffdceb

Please sign in to comment.