From 21c344a479a8fd359a9c875f3056a7e72fe4d5fb Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Wed, 4 Feb 2015 01:22:23 +0300 Subject: [PATCH] update vendor/src/github.com/syndtr/gocapability/ Signed-off-by: Andrey Vagin --- .../syndtr/gocapability/capability/capability.go | 3 ++- .../syndtr/gocapability/capability/capability_linux.go | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/vendor/src/github.com/syndtr/gocapability/capability/capability.go b/vendor/src/github.com/syndtr/gocapability/capability/capability.go index 9df3b415..c13f4e52 100644 --- a/vendor/src/github.com/syndtr/gocapability/capability/capability.go +++ b/vendor/src/github.com/syndtr/gocapability/capability/capability.go @@ -60,7 +60,8 @@ type Capabilities interface { Apply(kind CapType) error } -// NewPid create new initialized Capabilities object for given pid. +// NewPid create new initialized Capabilities object for given pid when it +// is nonzero, or for the current pid if pid is 0 func NewPid(pid int) (Capabilities, error) { return newPid(pid) } diff --git a/vendor/src/github.com/syndtr/gocapability/capability/capability_linux.go b/vendor/src/github.com/syndtr/gocapability/capability/capability_linux.go index c5f335f7..3f658e52 100644 --- a/vendor/src/github.com/syndtr/gocapability/capability/capability_linux.go +++ b/vendor/src/github.com/syndtr/gocapability/capability/capability_linux.go @@ -351,7 +351,15 @@ func (c *capsV3) Load() (err error) { return } - f, err := os.Open(fmt.Sprintf("/proc/%d/status", c.hdr.pid)) + var status_path string + + if c.hdr.pid == 0 { + status_path = fmt.Sprintf("/proc/self/status") + } else { + status_path = fmt.Sprintf("/proc/%d/status", c.hdr.pid) + } + + f, err := os.Open(status_path) if err != nil { return }