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

Just a cleanup of commit 32f881c6c42f94da70a3782fe20a058fe3dc39cc. --- src/lxc/lxc_container.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index e93fda5..2282eb0 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,17 @@ 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 (virAsprintf(&opts, "mode=755,size=65536%s%s%s", - con ? ",context=\"" : "", - con ? (const char *)con : "", - con ? "\"" : "") < 0) { + +#if HAVE_SELINUX + if (con) + ignore_value(virAsprintf(&opts, + "mode=755,size=65536,context=\"%s\"", + (const char *)con)); + else +#endif + opts = strdup("mode=755,size=65536"); + + if (!opts) { virReportOOMError(); goto cleanup; } -- 1.7.3.4

On 02/10/2012 08:22 AM, Martin Kletzander wrote:
Just a cleanup of commit 32f881c6c42f94da70a3782fe20a058fe3dc39cc. --- src/lxc/lxc_container.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Fri, Feb 10, 2012 at 11:13:54 -0700, Eric Blake wrote:
On 02/10/2012 08:22 AM, Martin Kletzander wrote:
Just a cleanup of commit 32f881c6c42f94da70a3782fe20a058fe3dc39cc. --- src/lxc/lxc_container.c | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-)
ACK.
I changed the subject since referring to a fix from last week is not really valid now and pushed this forgotten patch. Jirka
participants (3)
-
Eric Blake
-
Jiri Denemark
-
Martin Kletzander