domain_conf: rewrite conditions in virDomainObjWaitUntil()

This patch rewrites conditions to make the code easier to read and less
nested.

Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Kristina Hanicova 2022-07-21 12:45:52 +02:00 committed by Martin Kletzander
parent 0f729b6ce0
commit bad1206ce9

View File

@ -4009,15 +4009,15 @@ int
virDomainObjWaitUntil(virDomainObj *vm, virDomainObjWaitUntil(virDomainObj *vm,
unsigned long long whenms) unsigned long long whenms)
{ {
if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) < 0) { if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) >= 0)
if (errno != ETIMEDOUT) { return 0;
virReportSystemError(errno, "%s",
_("failed to wait for domain condition")); if (errno == ETIMEDOUT)
return -1;
}
return 1; return 1;
}
return 0; virReportSystemError(errno, "%s",
_("failed to wait for domain condition"));
return -1;
} }