render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
6ae9ed
From fd3758c438af5b2c4b571916bbe6bc4bf6e0bf4e Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <fd3758c438af5b2c4b571916bbe6bc4bf6e0bf4e@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Wed, 24 Aug 2016 16:11:04 -0400
6ae9ed
Subject: [PATCH] qemu: monitor: Add do-while block to QEMU_CHECK_MONITOR_FULL
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1097930
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1224341
6ae9ed
6ae9ed
Assure that it's just one statement to avoid problems when used with
6ae9ed
conditions.
6ae9ed
6ae9ed
(cherry picked from commit 0f889e725e2e132e1eed62de38995677abc5da41)
6ae9ed
---
6ae9ed
 src/qemu/qemu_monitor.c | 25 ++++++++++++++-----------
6ae9ed
 1 file changed, 14 insertions(+), 11 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
6ae9ed
index 2931f82..65e7a11 100644
6ae9ed
--- a/src/qemu/qemu_monitor.c
6ae9ed
+++ b/src/qemu/qemu_monitor.c
6ae9ed
@@ -112,17 +112,20 @@ struct _qemuMonitor {
6ae9ed
  * monitor.
6ae9ed
  */
6ae9ed
 #define QEMU_CHECK_MONITOR_FULL(mon, force_json, exit)                         \
6ae9ed
-    if (!mon) {                                                                \
6ae9ed
-        virReportError(VIR_ERR_INVALID_ARG, "%s",                              \
6ae9ed
-                       _("monitor must not be NULL"));                         \
6ae9ed
-        exit;                                                                  \
6ae9ed
-    }                                                                          \
6ae9ed
-    VIR_DEBUG("mon:%p vm:%p json:%d fd:%d", mon, mon->vm, mon->json, mon->fd); \
6ae9ed
-    if (force_json && !mon->json) {                                            \
6ae9ed
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",                    \
6ae9ed
-                       _("JSON monitor is required"));                         \
6ae9ed
-        exit;                                                                  \
6ae9ed
-    }
6ae9ed
+    do {                                                                       \
6ae9ed
+        if (!mon) {                                                            \
6ae9ed
+            virReportError(VIR_ERR_INVALID_ARG, "%s",                          \
6ae9ed
+                           _("monitor must not be NULL"));                     \
6ae9ed
+            exit;                                                              \
6ae9ed
+        }                                                                      \
6ae9ed
+        VIR_DEBUG("mon:%p vm:%p json:%d fd:%d",                                \
6ae9ed
+                  mon, mon->vm, mon->json, mon->fd);                           \
6ae9ed
+        if (force_json && !mon->json) {                                        \
6ae9ed
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",                \
6ae9ed
+                           _("JSON monitor is required"));                     \
6ae9ed
+            exit;                                                              \
6ae9ed
+        }                                                                      \
6ae9ed
+    } while (0)
6ae9ed
 
6ae9ed
 /* Check monitor and return NULL on error */
6ae9ed
 #define QEMU_CHECK_MONITOR_NULL(mon) \
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed