提交 8b71b0c7 编写于 作者: M Michal Privoznik

qemu_hotplug: Properly check for qemuMonitorDelDevice retval

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.

At the same time fix qemuDomainDetachExtensionDevice() reval
check. It is somewhat related to the aim of this patch.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 1dd24167
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册