提交 69b850fe 编写于 作者: J John Ferlan

qemu: Fix integer/boolean logic in qemuSetUnprivSGIO

Setting of 'val' is a boolean expression, so handle it that way and
adjust the check/return logic to be clearer
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 931ac3cd
...@@ -1433,7 +1433,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) ...@@ -1433,7 +1433,7 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
virDomainHostdevDefPtr hostdev = NULL; virDomainHostdevDefPtr hostdev = NULL;
char *sysfs_path = NULL; char *sysfs_path = NULL;
const char *path = NULL; const char *path = NULL;
int val = -1; bool val;
int ret = -1; int ret = -1;
/* "sgio" is only valid for block disk; cdrom /* "sgio" is only valid for block disk; cdrom
...@@ -1475,8 +1475,12 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev) ...@@ -1475,8 +1475,12 @@ qemuSetUnprivSGIO(virDomainDeviceDefPtr dev)
* whitelist is enabled. But if requesting unfiltered access, always call * whitelist is enabled. But if requesting unfiltered access, always call
* virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio. * virSetDeviceUnprivSGIO, to report an error for unsupported unpriv_sgio.
*/ */
if ((virFileExists(sysfs_path) || val == 1) && if (!val || !virFileExists(sysfs_path)) {
virSetDeviceUnprivSGIO(path, NULL, val) < 0) ret = 0;
goto cleanup;
}
if (virSetDeviceUnprivSGIO(path, NULL, 1) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册