]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Revert "qemu: Fix integer/boolean logic in qemuSetUnprivSGIO"
authorJohn Ferlan <jferlan@redhat.com>
Fri, 18 Sep 2015 12:18:38 +0000 (08:18 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 22 Sep 2015 14:17:36 +0000 (10:17 -0400)
This reverts commit 69b850fe2a19d0c32ae2f209e8d8463df6ead665.

This change broke the ability to "clear" or reset unfiltered back
to filtered.

src/qemu/qemu_conf.c

index 1ce459f09a7d4a3e18fab33843e7d8ef6872ee67..658a50e3be0248c57faea865dd2e2fe2b8279c4c 100644 (file)
@@ -1433,7 +1433,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
     virDomainHostdevDefPtr hostdev = NULL;
     char *sysfs_path = NULL;
     const char *path = NULL;
-    bool val;
+    int val = -1;
     int ret = -1;
 
     /* "sgio" is only valid for block disk; cdrom
@@ -1475,12 +1475,8 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
      * whitelist is enabled.  But if requesting unfiltered access, always call
      * virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio.
      */
-    if (!val || !virFileExists(sysfs_path)) {
-        ret = 0;
-        goto cleanup;
-    }
-
-    if (virSetDeviceUnprivSGIO(path, NULL, 1) < 0)
+    if ((virFileExists(sysfs_path) || val == 1) &&
+        virSetDeviceUnprivSGIO(path, NULL, val) < 0)
         goto cleanup;
 
     ret = 0;