[PATCH v2 7/8] domain_conf: rewrite conditions in virDomainObjWaitUntil()

Kristina Hanicova khanicov at redhat.com
Thu Jul 21 10:45:52 UTC 2022


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

Signed-off-by: Kristina Hanicova <khanicov at redhat.com>
---
 src/conf/domain_conf.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 507bff953c..bbe6574487 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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;
 }
 
 
-- 
2.35.3



More information about the libvir-list mailing list