Skip to content

Commit 6988afe

Browse files
Merge pull request #1724 from wking/no-pid-for-capability-lookup
libcontainer/capabilities_linux: Drop os.Getpid() call
2 parents a618ab5 + 50dc7ee commit 6988afe

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

libcontainer/capabilities_linux.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ package libcontainer
44

55
import (
66
"fmt"
7-
"os"
87
"strings"
98

109
"github.com/opencontainers/runc/libcontainer/configs"
@@ -72,7 +71,7 @@ func newContainerCapList(capConfig *configs.Capabilities) (*containerCapabilitie
7271
}
7372
ambient = append(ambient, v)
7473
}
75-
pid, err := capability.NewPid(os.Getpid())
74+
pid, err := capability.NewPid(0)
7675
if err != nil {
7776
return nil, err
7877
}

libcontainer/container_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,7 @@ func (c *linuxContainer) bootstrapData(cloneFlags uintptr, nsMaps map[configs.Na
18041804
// The following only applies if we are root.
18051805
if !c.config.Rootless {
18061806
// check if we have CAP_SETGID to setgroup properly
1807-
pid, err := capability.NewPid(os.Getpid())
1807+
pid, err := capability.NewPid(0)
18081808
if err != nil {
18091809
return nil, err
18101810
}

0 commit comments

Comments
 (0)