summaryrefslogtreecommitdiff
path: root/vendor/github.com/syndtr/gocapability
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2019-01-08 14:52:57 +0100
committerValentin Rothberg <rothberg@redhat.com>2019-01-11 13:38:11 +0100
commitbd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87 (patch)
tree5f06e4e289f16d9164d692590a3fe6541b5384cf /vendor/github.com/syndtr/gocapability
parent545f24421247c9f6251a634764db3f8f8070a812 (diff)
downloadpodman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.tar.gz
podman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.tar.bz2
podman-bd40dcfc2bc7c9014ea1f33482fb63aacbcdfe87.zip
vendor: update everything
* If possible, update each dependency to the latest available version. * Use releases over commit IDs and avoid vendoring branches. Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/syndtr/gocapability')
-rw-r--r--vendor/github.com/syndtr/gocapability/capability/capability.go71
-rw-r--r--vendor/github.com/syndtr/gocapability/capability/capability_linux.go16
-rw-r--r--vendor/github.com/syndtr/gocapability/capability/syscall_linux.go2
3 files changed, 71 insertions, 18 deletions
diff --git a/vendor/github.com/syndtr/gocapability/capability/capability.go b/vendor/github.com/syndtr/gocapability/capability/capability.go
index c07c55794..61a90775e 100644
--- a/vendor/github.com/syndtr/gocapability/capability/capability.go
+++ b/vendor/github.com/syndtr/gocapability/capability/capability.go
@@ -60,13 +60,74 @@ type Capabilities interface {
Apply(kind CapType) error
}
-// NewPid create new initialized Capabilities object for given pid when it
-// is nonzero, or for the current pid if pid is 0
+// NewPid initializes a new Capabilities object for given pid when
+// it is nonzero, or for the current process if pid is 0.
+//
+// Deprecated: Replace with NewPid2. For example, replace:
+//
+// c, err := NewPid(0)
+// if err != nil {
+// return err
+// }
+//
+// with:
+//
+// c, err := NewPid2(0)
+// if err != nil {
+// return err
+// }
+// err = c.Load()
+// if err != nil {
+// return err
+// }
func NewPid(pid int) (Capabilities, error) {
+ c, err := newPid(pid)
+ if err != nil {
+ return c, err
+ }
+ err = c.Load()
+ return c, err
+}
+
+// NewPid2 initializes a new Capabilities object for given pid when
+// it is nonzero, or for the current process if pid is 0. This
+// does not load the process's current capabilities; to do that you
+// must call Load explicitly.
+func NewPid2(pid int) (Capabilities, error) {
return newPid(pid)
}
-// NewFile create new initialized Capabilities object for given named file.
-func NewFile(name string) (Capabilities, error) {
- return newFile(name)
+// NewFile initializes a new Capabilities object for given file path.
+//
+// Deprecated: Replace with NewFile2. For example, replace:
+//
+// c, err := NewFile(path)
+// if err != nil {
+// return err
+// }
+//
+// with:
+//
+// c, err := NewFile2(path)
+// if err != nil {
+// return err
+// }
+// err = c.Load()
+// if err != nil {
+// return err
+// }
+func NewFile(path string) (Capabilities, error) {
+ c, err := newFile(path)
+ if err != nil {
+ return c, err
+ }
+ err = c.Load()
+ return c, err
+}
+
+// NewFile2 creates a new initialized Capabilities object for given
+// file path. This does not load the process's current capabilities;
+// to do that you must call Load explicitly.
+func NewFile2(path string) (Capabilities, error) {
+ return newFile(path)
}
diff --git a/vendor/github.com/syndtr/gocapability/capability/capability_linux.go b/vendor/github.com/syndtr/gocapability/capability/capability_linux.go
index 6d2135ac5..1567dc810 100644
--- a/vendor/github.com/syndtr/gocapability/capability/capability_linux.go
+++ b/vendor/github.com/syndtr/gocapability/capability/capability_linux.go
@@ -103,21 +103,17 @@ func newPid(pid int) (c Capabilities, err error) {
case linuxCapVer1:
p := new(capsV1)
p.hdr.version = capVers
- p.hdr.pid = pid
+ p.hdr.pid = int32(pid)
c = p
case linuxCapVer2, linuxCapVer3:
p := new(capsV3)
p.hdr.version = capVers
- p.hdr.pid = pid
+ p.hdr.pid = int32(pid)
c = p
default:
err = errUnknownVers
return
}
- err = c.Load()
- if err != nil {
- c = nil
- }
return
}
@@ -428,11 +424,11 @@ func (c *capsV3) Load() (err error) {
}
if strings.HasPrefix(line, "CapB") {
fmt.Sscanf(line[4:], "nd: %08x%08x", &c.bounds[1], &c.bounds[0])
- break
+ continue
}
if strings.HasPrefix(line, "CapA") {
fmt.Sscanf(line[4:], "mb: %08x%08x", &c.ambient[1], &c.ambient[0])
- break
+ continue
}
}
f.Close()
@@ -492,10 +488,6 @@ func (c *capsV3) Apply(kind CapType) (err error) {
func newFile(path string) (c Capabilities, err error) {
c = &capsFile{path: path}
- err = c.Load()
- if err != nil {
- c = nil
- }
return
}
diff --git a/vendor/github.com/syndtr/gocapability/capability/syscall_linux.go b/vendor/github.com/syndtr/gocapability/capability/syscall_linux.go
index eb7170083..3d2bf6927 100644
--- a/vendor/github.com/syndtr/gocapability/capability/syscall_linux.go
+++ b/vendor/github.com/syndtr/gocapability/capability/syscall_linux.go
@@ -13,7 +13,7 @@ import (
type capHeader struct {
version uint32
- pid int
+ pid int32
}
type capData struct {