[libvirt] [PATCH] Cleanup of the quick dirty fix from last week

Martin Kletzander mkletzan at redhat.com
Thu Feb 9 15:00:35 UTC 2012


I tried lots of different solutions and this seems like the most clean
and readable one.
---
 src/lxc/lxc_container.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index e93fda5..c55f264 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -449,8 +449,6 @@ static int lxcContainerMountBasicFS(const char *srcprefix, bool pivotRoot)
     char *opts = NULL;
 #if HAVE_SELINUX
     security_context_t con;
-#else
-    bool con = false;
 #endif

     VIR_DEBUG("Mounting basic filesystems %s pivotRoot=%d", NULLSTR(srcprefix), pivotRoot);
@@ -511,10 +509,14 @@ static int lxcContainerMountBasicFS(const char *srcprefix, bool pivotRoot)
          * tmpfs is limited to 64kb, since we only have device nodes in there
          * and don't want to DOS the entire OS RAM usage
          */
+#if HAVE_SELINUX
         if (virAsprintf(&opts, "mode=755,size=65536%s%s%s",
                         con ? ",context=\"" : "",
                         con ? (const char *)con : "",
                         con ? "\"" : "") < 0) {
+#else
+        if (virAsprintf(&opts, "mode=755,size=65536") < 0) {
+#endif
             virReportOOMError();
             goto cleanup;
         }
--
1.7.3.4




More information about the libvir-list mailing list