]> xenbits.xensource.com Git - libvirt.git/commitdiff
domain_conf: rewrite conditions in virDomainObjWaitUntil()
authorKristina Hanicova <khanicov@redhat.com>
Thu, 21 Jul 2022 10:45:52 +0000 (12:45 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Fri, 22 Jul 2022 10:57:07 +0000 (12:57 +0200)
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>
src/conf/domain_conf.c

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