Skip to content

Commit

Permalink
Avoid use of a deprecated capability.NewPid
Browse files Browse the repository at this point in the history
This is reported by golangci-lint.

(Absolutely untested.)

Signed-off-by: Miloslav Trmač <[email protected]>
  • Loading branch information
mtrmac committed Apr 5, 2023
1 parent 1e70fee commit 4f5e821
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 4f5e821

Please sign in to comment.