]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Don't mount selinux fs in LXC if selinux is disabled
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 15 May 2013 15:26:59 +0000 (16:26 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 16 May 2013 15:28:53 +0000 (16:28 +0100)
Before trying to mount the selinux filesystem in a container
use is_selinux_enabled() to check if the machine actually
has selinux support (eg not booted with selinux=0)

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/lxc/lxc_container.c

index e7eec6ef200ffa1654a94d19037e2b43cd473b57..48ccc09a5b7e6cffb6e6b7c8fb36d58fa0aa6245 100644 (file)
@@ -702,6 +702,12 @@ static int lxcContainerMountBasicFS(char *sec_mount_options)
             (access(srcpath, R_OK) < 0))
             continue;
 
+#if WITH_SELINUX
+        if (STREQ(mnts[i].src, SELINUX_MOUNT) &&
+            !is_selinux_enabled())
+            continue;
+#endif
+
         if (virFileMakePath(mnts[i].dst) < 0) {
             virReportSystemError(errno,
                                  _("Failed to mkdir %s"),