render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
7a3408
From e70e020cf8c946d4f5df161d469d6e2b626cccd2 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <e70e020cf8c946d4f5df161d469d6e2b626cccd2@dist-git>
7a3408
From: John Ferlan <jferlan@redhat.com>
7a3408
Date: Tue, 22 Sep 2015 11:02:05 -0400
7a3408
Subject: [PATCH] Revert "qemu: Fix integer/boolean logic in qemuSetUnprivSGIO"
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1072736
7a3408
7a3408
This reverts commit 69b850fe2a19d0c32ae2f209e8d8463df6ead665. (upstream)
7a3408
This reverts commit 8c46231056f7c633a9f8576018d764e3a0b7251f. (downstream)
7a3408
7a3408
This change broke the ability to "clear" or reset unfiltered back
7a3408
to filtered.
7a3408
7a3408
(cherry picked from commit ec6754db57510173be372e3981ddb6a5cefbcce0)
7a3408
Signed-off-by: John Ferlan <jferlan@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_conf.c | 10 +++-------
7a3408
 1 file changed, 3 insertions(+), 7 deletions(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
7a3408
index 030261e..8abbb02 100644
7a3408
--- a/src/qemu/qemu_conf.c
7a3408
+++ b/src/qemu/qemu_conf.c
7a3408
@@ -1449,7 +1449,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
7a3408
     char *sysfs_path = NULL;
7a3408
     char *hostdev_path = NULL;
7a3408
     const char *path = NULL;
7a3408
-    bool val;
7a3408
+    int val = -1;
7a3408
     int ret = -1;
7a3408
 
7a3408
     /* "sgio" is only valid for block disk; cdrom
7a3408
@@ -1491,12 +1491,8 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
7a3408
      * whitelist is enabled.  But if requesting unfiltered access, always call
7a3408
      * virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio.
7a3408
      */
7a3408
-    if (!val || !virFileExists(sysfs_path)) {
7a3408
-        ret = 0;
7a3408
-        goto cleanup;
7a3408
-    }
7a3408
-
7a3408
-    if (virSetDeviceUnprivSGIO(path, NULL, 1) < 0)
7a3408
+    if ((virFileExists(sysfs_path) || val == 1) &&
7a3408
+        virSetDeviceUnprivSGIO(path, NULL, val) < 0)
7a3408
         goto cleanup;
7a3408
 
7a3408
     ret = 0;
7a3408
-- 
7a3408
2.5.3
7a3408