[libvirt] [PATCH] Fixed connection definition for non-SELinux builds

This patch fixes the access of variable "con" in two files where the variable was declared only on SELinux builds and thus the build failed without SELinux. It's a rather nasty fix but helps fix the build quickly and without any major changes to the code. --- src/lxc/lxc_container.c | 2 ++ src/lxc/lxc_controller.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index d1156e4..1c148e2 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -449,6 +449,8 @@ 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); diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index fedb7c8..8f336f5 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -1438,6 +1438,8 @@ lxcControllerRun(virDomainDefPtr def, if (root) { #if HAVE_SELINUX security_context_t con; +#else + bool con = false; #endif char *opts; VIR_DEBUG("Setting up private /dev/pts"); -- 1.7.3.4

On 03.02.2012 16:03, Martin Kletzander wrote:
This patch fixes the access of variable "con" in two files where the variable was declared only on SELinux builds and thus the build failed without SELinux. It's a rather nasty fix but helps fix the build quickly and without any major changes to the code. --- src/lxc/lxc_container.c | 2 ++ src/lxc/lxc_controller.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
ACK & pushed. Michal

On 02/03/2012 08:03 AM, Martin Kletzander wrote:
This patch fixes the access of variable "con" in two files where the variable was declared only on SELinux builds and thus the build failed without SELinux. It's a rather nasty fix but helps fix the build quickly and without any major changes to the code. --- src/lxc/lxc_container.c | 2 ++ src/lxc/lxc_controller.c | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index d1156e4..1c148e2 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -449,6 +449,8 @@ static int lxcContainerMountBasicFS(const char *srcprefix, bool pivotRoot) char *opts = NULL; #if HAVE_SELINUX security_context_t con; +#else + bool con = false;
I would have used 'char *con = NULL', as security_context_t is more likely to be a pointer type than a boolean, and since we already have a '(const char*)con' cast at one point in the code (casting a bool to char* is fishy). But I guess your hack is okay. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Eric Blake
-
Martin Kletzander
-
Michal Privoznik