mirror of
https://github.com/containers/skopeo.git
synced 2025-09-27 05:03:41 +00:00
Bump github.com/containers/common from 0.36.0 to 0.37.0
Bumps [github.com/containers/common](https://github.com/containers/common) from 0.36.0 to 0.37.0. - [Release notes](https://github.com/containers/common/releases) - [Commits](https://github.com/containers/common/compare/v0.36.0...v0.37.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
committed by
Daniel J Walsh
parent
2d3f3ed901
commit
610c612129
22
vendor/github.com/containers/storage/pkg/unshare/unshare.go
generated
vendored
22
vendor/github.com/containers/storage/pkg/unshare/unshare.go
generated
vendored
@@ -7,12 +7,17 @@ import (
|
||||
"sync"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/syndtr/gocapability/capability"
|
||||
)
|
||||
|
||||
var (
|
||||
homeDirOnce sync.Once
|
||||
homeDirErr error
|
||||
homeDir string
|
||||
|
||||
hasCapSysAdminOnce sync.Once
|
||||
hasCapSysAdminRet bool
|
||||
hasCapSysAdminErr error
|
||||
)
|
||||
|
||||
// HomeDir returns the home directory for the current user.
|
||||
@@ -32,3 +37,20 @@ func HomeDir() (string, error) {
|
||||
})
|
||||
return homeDir, homeDirErr
|
||||
}
|
||||
|
||||
// HasCapSysAdmin returns whether the current process has CAP_SYS_ADMIN.
|
||||
func HasCapSysAdmin() (bool, error) {
|
||||
hasCapSysAdminOnce.Do(func() {
|
||||
currentCaps, err := capability.NewPid2(0)
|
||||
if err != nil {
|
||||
hasCapSysAdminErr = err
|
||||
return
|
||||
}
|
||||
if err = currentCaps.Load(); err != nil {
|
||||
hasCapSysAdminErr = err
|
||||
return
|
||||
}
|
||||
hasCapSysAdminRet = currentCaps.Get(capability.EFFECTIVE, capability.CAP_SYS_ADMIN)
|
||||
})
|
||||
return hasCapSysAdminRet, hasCapSysAdminErr
|
||||
}
|
||||
|
Reference in New Issue
Block a user