mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-10 21:53:57 +08:00
libcontainer/system: move userns utilities to separate package
Moving these utilities to a separate package, so that consumers of this package don't have to pull in the whole "system" package. Looking at uses of these utilities (outside of runc itself); `RunningInUserNS()` is used by [various external consumers][1], so adding a "Deprecated" alias for this. [1]: https://grep.app/search?current=2&q=.RunningInUserNS Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
+3
-3
@@ -6,7 +6,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/opencontainers/runc/libcontainer/cgroups/systemd"
|
||||
"github.com/opencontainers/runc/libcontainer/system"
|
||||
"github.com/opencontainers/runc/libcontainer/userns"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
@@ -25,7 +25,7 @@ func shouldUseRootlessCgroupManager(context *cli.Context) (bool, error) {
|
||||
if os.Geteuid() != 0 {
|
||||
return true, nil
|
||||
}
|
||||
if !system.RunningInUserNS() {
|
||||
if !userns.RunningInUserNS() {
|
||||
// euid == 0 , in the initial ns (i.e. the real root)
|
||||
return false, nil
|
||||
}
|
||||
@@ -60,7 +60,7 @@ func shouldHonorXDGRuntimeDir() bool {
|
||||
if os.Geteuid() != 0 {
|
||||
return true
|
||||
}
|
||||
if !system.RunningInUserNS() {
|
||||
if !userns.RunningInUserNS() {
|
||||
// euid == 0 , in the initial ns (i.e. the real root)
|
||||
// in this case, we should use /run/runc and ignore
|
||||
// $XDG_RUNTIME_DIR (e.g. /run/user/0) for backward
|
||||
|
||||
Reference in New Issue
Block a user