Luckily, the function returns only 0 or -1 so all the checks work
as expected. Anyway, our rule is that a positive value means
success so if the function ever returns a positive value these
checks will fail. Make them check for a negative value properly.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 19b7e6e8ea..f43f80668c 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -5457,11 +5457,11 @@ int qemuDomainDetachControllerDevice(virQEMUDriverPtr driver,
qemuDomainObjEnterMonitor(driver, vm);
if (detach->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI &&
- qemuDomainDetachExtensionDevice(priv->mon, &detach->info)) {
+ qemuDomainDetachExtensionDevice(priv->mon, &detach->info) < 0) {
goto exit_monitor;
}
- if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
+ if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto cleanup;
}
@@ -6975,7 +6975,7 @@ qemuDomainDetachInputDevice(virDomainObjPtr vm,
qemuDomainMarkDeviceForRemoval(vm, &input->info);
qemuDomainObjEnterMonitor(driver, vm);
- if (qemuMonitorDelDevice(priv->mon, input->info.alias)) {
+ if (qemuMonitorDelDevice(priv->mon, input->info.alias) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto cleanup;
}
@@ -7018,7 +7018,7 @@ qemuDomainDetachVsockDevice(virDomainObjPtr vm,
qemuDomainMarkDeviceForRemoval(vm, &vsock->info);
qemuDomainObjEnterMonitor(driver, vm);
- if (qemuMonitorDelDevice(priv->mon, vsock->info.alias)) {
+ if (qemuMonitorDelDevice(priv->mon, vsock->info.alias) < 0) {
ignore_value(qemuDomainObjExitMonitor(driver, vm));
goto cleanup;
}
--
2.19.2