]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: monitor: Add do-while block to QEMU_CHECK_MONITOR_FULL
authorPeter Krempa <pkrempa@redhat.com>
Fri, 29 Jul 2016 07:04:34 +0000 (09:04 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 4 Aug 2016 06:03:46 +0000 (08:03 +0200)
Assure that it's just one statement to avoid problems when used with
conditions.

src/qemu/qemu_monitor.c

index 3e80376b82fcfeed039706208a9d8a703b385c73..3455590f20403b39584d53021741670dc98244e9 100644 (file)
@@ -112,17 +112,20 @@ struct _qemuMonitor {
  * monitor.
  */
 #define QEMU_CHECK_MONITOR_FULL(mon, force_json, exit)                         \
-    if (!mon) {                                                                \
-        virReportError(VIR_ERR_INVALID_ARG, "%s",                              \
-                       _("monitor must not be NULL"));                         \
-        exit;                                                                  \
-    }                                                                          \
-    VIR_DEBUG("mon:%p vm:%p json:%d fd:%d", mon, mon->vm, mon->json, mon->fd); \
-    if (force_json && !mon->json) {                                            \
-        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",                    \
-                       _("JSON monitor is required"));                         \
-        exit;                                                                  \
-    }
+    do {                                                                       \
+        if (!mon) {                                                            \
+            virReportError(VIR_ERR_INVALID_ARG, "%s",                          \
+                           _("monitor must not be NULL"));                     \
+            exit;                                                              \
+        }                                                                      \
+        VIR_DEBUG("mon:%p vm:%p json:%d fd:%d",                                \
+                  mon, mon->vm, mon->json, mon->fd);                           \
+        if (force_json && !mon->json) {                                        \
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",                \
+                           _("JSON monitor is required"));                     \
+            exit;                                                              \
+        }                                                                      \
+    } while (0)
 
 /* Check monitor and return NULL on error */
 #define QEMU_CHECK_MONITOR_NULL(mon) \