The return value of virDomainControllerFind >=0 means that
the specific controller was found.
But some functions invoke it and treat 0 as not found.
This patch fix these incorrect invocation.
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
case VIR_DOMAIN_DEVICE_CONTROLLER:
controller = dev->data.controller;
if (virDomainControllerFind(vmdef, controller->type,
- controller->idx) > 0) {
+ controller->idx) >= 0) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Target already exists"));
return -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
bool releaseaddr = false;
- if (virDomainControllerFind(vm->def, controller->type, controller->idx) > 0) {
+ if (virDomainControllerFind(vm->def, controller->type, controller->idx) >= 0) {
virReportError(VIR_ERR_OPERATION_FAILED,
_("target %s:%d already exists"),
type, controller->idx);