From 249356a1a44112be0b894ae152207f599c5d7b15 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 22 Mar 2021 14:36:44 +0100 Subject: [PATCH] libcontainer/system: remove unused GetParentNSeuid() This function was added in f103de57ec89137d86b77584f676b760ec7c7ba4, but no longer used since 06f789cf26774dd64cb2a9cc0b3c6a6ff832733bc (v1.0.0-rc6) Signed-off-by: Sebastiaan van Stijn --- libcontainer/system/linux.go | 17 ----------------- libcontainer/system/unsupported.go | 8 -------- 2 files changed, 25 deletions(-) diff --git a/libcontainer/system/linux.go b/libcontainer/system/linux.go index 49471960b..f72602560 100644 --- a/libcontainer/system/linux.go +++ b/libcontainer/system/linux.go @@ -3,7 +3,6 @@ package system import ( - "os" "os/exec" "sync" "unsafe" @@ -117,22 +116,6 @@ func UIDMapInUserNS(uidmap []user.IDMap) bool { return true } -// GetParentNSeuid returns the euid within the parent user namespace -func GetParentNSeuid() int64 { - euid := int64(os.Geteuid()) - uidmap, err := user.CurrentProcessUIDMap() - if err != nil { - // This kernel-provided file only exists if user namespaces are supported - return euid - } - for _, um := range uidmap { - if um.ID <= euid && euid <= um.ID+um.Count-1 { - return um.ParentID + euid - um.ID - } - } - return euid -} - // SetSubreaper sets the value i as the subreaper setting for the calling process func SetSubreaper(i int) error { return unix.Prctl(unix.PR_SET_CHILD_SUBREAPER, uintptr(i), 0, 0, 0) diff --git a/libcontainer/system/unsupported.go b/libcontainer/system/unsupported.go index b94be74a6..0adf94012 100644 --- a/libcontainer/system/unsupported.go +++ b/libcontainer/system/unsupported.go @@ -3,8 +3,6 @@ package system import ( - "os" - "github.com/opencontainers/runc/libcontainer/user" ) @@ -19,9 +17,3 @@ func RunningInUserNS() bool { func UIDMapInUserNS(uidmap []user.IDMap) bool { return false } - -// GetParentNSeuid returns the euid within the parent user namespace -// Always returns os.Geteuid on non-linux -func GetParentNSeuid() int { - return os.Geteuid() -}