Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > ebe084c140192657f9094e135a84202c > files > 124

libvirt-0.8.2-29.el5.src.rpm

From 1b6bd81582a819a0dbeb8bd672fc2d4593e0a1fa Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Thu, 27 Oct 2011 15:40:28 -0600
Subject: [PATCH] qemuConnectMonitor: fix a bug that would have masked SELinux
 failure
To: libvir-list@redhat.com

https://bugzilla.redhat.com/show_bug.cgi?id=747514

* src/qemu/qemu_driver.c (qemuConnectMonitor): Correct erroneous
parenthesization in two expressions.  Without this fix, failure
to set or clear SELinux security context in the monitor would go
undiagnosed.  Also correct a diagnostic and split some long lines.
(cherry picked from commit c1fd7d7b3e7a1b80d641f6300be9d91e2d238a7b)

Signed-off-by: Daniel Veillard <veillard@redhat.com>
---
 src/qemu/qemu_driver.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3a48966..3f75738 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1216,10 +1216,12 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
     qemuDomainObjPrivatePtr priv = vm->privateData;
     int ret = -1;
 
-    if ((driver->securityDriver &&
-         driver->securityDriver->domainSetSecuritySocketLabel &&
-         driver->securityDriver->domainSetSecuritySocketLabel(driver->securityDriver,vm)) < 0) {
-        VIR_ERROR(_("Failed to set security context for monitor for %s"), vm->def->name);
+    if (driver->securityDriver &&
+        driver->securityDriver->domainSetSecuritySocketLabel &&
+        driver->securityDriver->domainSetSecuritySocketLabel
+          (driver->securityDriver,vm) < 0) {
+        VIR_ERROR(_("Failed to set security context for monitor for %s"),
+                  vm->def->name);
         goto error;
     }
 
@@ -1235,10 +1237,12 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
     if (priv->mon == NULL)
         virDomainObjUnref(vm);
 
-    if ((driver->securityDriver &&
-         driver->securityDriver->domainClearSecuritySocketLabel &&
-         driver->securityDriver->domainClearSecuritySocketLabel(driver->securityDriver,vm)) < 0) {
-        VIR_ERROR(_("Failed to set security context for monitor for %s"), vm->def->name);
+    if (driver->securityDriver &&
+        driver->securityDriver->domainClearSecuritySocketLabel &&
+        driver->securityDriver->domainClearSecuritySocketLabel
+          (driver->securityDriver,vm) < 0) {
+        VIR_ERROR(_("Failed to clear security context for monitor for %s"),
+                  vm->def->name);
         goto error;
     }
 
-- 
1.7.4.4