Merge pull request #1724 from wking/no-pid-for-capability-lookup

libcontainer/capabilities_linux: Drop os.Getpid() call
This commit is contained in:
Michael Crosby 2018-02-20 09:40:33 -05:00 committed by GitHub
commit 6988afe05d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 3 deletions

View File

@ -4,7 +4,6 @@ package libcontainer
import (
"fmt"
"os"
"strings"
"github.com/opencontainers/runc/libcontainer/configs"
@ -72,7 +71,7 @@ func newContainerCapList(capConfig *configs.Capabilities) (*containerCapabilitie
}
ambient = append(ambient, v)
}
pid, err := capability.NewPid(os.Getpid())
pid, err := capability.NewPid(0)
if err != nil {
return nil, err
}

View File

@ -1804,7 +1804,7 @@ func (c *linuxContainer) bootstrapData(cloneFlags uintptr, nsMaps map[configs.Na
// The following only applies if we are root.
if !c.config.Rootless {
// check if we have CAP_SETGID to setgroup properly
pid, err := capability.NewPid(os.Getpid())
pid, err := capability.NewPid(0)
if err != nil {
return nil, err
}