From 15a26d6192ed24cb97f443a06a1514e82e58b43f Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 10 Oct 2016 17:34:37 +0000 Subject: [PATCH] platform/tests: skip root tests when we can't mount /sys/devices --- src/platform/tests/test-common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/tests/test-common.c b/src/platform/tests/test-common.c index b1947a6d11..51d2a5e234 100644 --- a/src/platform/tests/test-common.c +++ b/src/platform/tests/test-common.c @@ -1554,6 +1554,10 @@ unshare_user (void) uid_t uid = geteuid (); gid_t gid = getegid (); + /* Don't try to set up the namespaces if we're in a container. */ + if (!nmtstp_is_sysfs_writable ()) + return FALSE; + /* Already a root? */ if (gid == 0 && uid == 0) return TRUE;