From: Daniel P. Berrange Date: Wed, 15 May 2013 15:26:59 +0000 (+0100) Subject: Don't mount selinux fs in LXC if selinux is disabled X-Git-Tag: v1.0.6-rc1~154 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95c6cc344bec8405636d2a59fc0c34e0581001ab;p=thirdparty%2Flibvirt.git Don't mount selinux fs in LXC if selinux is disabled 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 --- diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index e7eec6ef20..48ccc09a5b 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -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"),