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

Kristina Hanicova khanicov at redhat.com
Wed Jul 20 13:11:11 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 1c29a2d929..e52f39c809 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3999,15 +3999,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