summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-02 14:45:27 -0400
committerGitHub <noreply@github.com>2020-10-02 14:45:27 -0400
commit1e162edc8a2dd3d8373128e671c578ffcad52272 (patch)
treeb94f581c888c0bf283e41146b35f12d87a113dc0 /pkg/specgen
parent819a4e02888b92c3120f513f398993a165f69028 (diff)
parentd30121969f0ba7b16700238b876a6bba7417875a (diff)
downloadpodman-1e162edc8a2dd3d8373128e671c578ffcad52272.tar.gz
podman-1e162edc8a2dd3d8373128e671c578ffcad52272.tar.bz2
podman-1e162edc8a2dd3d8373128e671c578ffcad52272.zip
Merge pull request #7882 from giuseppe/check-for-gids-before-adding-them
libpod: check there are enough gids before adding them
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/oci.go15
1 files changed, 1 insertions, 14 deletions
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go
index b57ddf1aa..f02432f5b 100644
--- a/pkg/specgen/generate/oci.go
+++ b/pkg/specgen/generate/oci.go
@@ -10,7 +10,6 @@ import (
"github.com/containers/podman/v2/libpod/image"
"github.com/containers/podman/v2/pkg/rootless"
"github.com/containers/podman/v2/pkg/specgen"
- "github.com/opencontainers/runc/libcontainer/user"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/opencontainers/runtime-tools/generate"
"github.com/pkg/errors"
@@ -200,7 +199,7 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
}
gid5Available := true
if isRootless {
- nGids, err := GetAvailableGids()
+ nGids, err := rootless.GetAvailableGids()
if err != nil {
return nil, err
}
@@ -360,15 +359,3 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
return configSpec, nil
}
-
-func GetAvailableGids() (int64, error) {
- idMap, err := user.ParseIDMapFile("/proc/self/gid_map")
- if err != nil {
- return 0, err
- }
- count := int64(0)
- for _, r := range idMap {
- count += r.Count
- }
- return count, nil
-}