rootless: RunningInUserNS() is now part of userns namespace

Previously part of the "system" namespace, the RunningInUserNS() has
been moved to the "userns" namespace.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
Fabiano Fidêncio 2021-07-26 08:11:41 +02:00
parent b5293c5214
commit c0f801c0c4
2 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ import (
"sync"
"github.com/containernetworking/plugins/pkg/ns"
"github.com/opencontainers/runc/libcontainer/system"
"github.com/opencontainers/runc/libcontainer/userns"
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
)
@ -78,7 +78,7 @@ func isRootlessFunc() bool {
if os.Geteuid() != 0 {
return true
}
if system.RunningInUserNS() {
if userns.RunningInUserNS() {
return true
}
SetRootless(false)

View File

@ -9,7 +9,7 @@ import (
"os"
"testing"
"github.com/opencontainers/runc/libcontainer/system"
"github.com/opencontainers/runc/libcontainer/userns"
"github.com/stretchr/testify/assert"
)
@ -21,7 +21,7 @@ func TestIsRootless(t *testing.T) {
if os.Getuid() != 0 {
rootless = true
} else {
rootless = system.RunningInUserNS()
rootless = userns.RunningInUserNS()
}
assert.Equal(rootless, isRootlessFunc())