[Pkg-libvirt-commits] [libguestfs] 08/24: launch: libvirt / p2v: Fix empty_element macro.

Hilko Bengen bengen at moszumanska.debian.org
Fri Oct 3 14:41:02 UTC 2014


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch master
in repository libguestfs.

commit d9208ada41ee3f2e0c3e5d13d20eba9f61ed8ccd
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Wed Sep 3 14:01:20 2014 +0100

    launch: libvirt / p2v: Fix empty_element macro.
    
    The empty_element macro was not safe when used in a "naked" if
    statement such as:
    
      if (config->flags & FLAG_ACPI) empty_element ("acpi");
    
    Fix the macro so it uses do { ... } while (0) to make it safe here.
    
    (cherry picked from commit 44ca9d563a93126bd744a819dde7237d371fe1fd)
---
 src/launch-libvirt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index cde686f..6250089 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -843,7 +843,8 @@ static int construct_libvirt_xml_appliance (guestfs_h *g, const struct libvirt_x
   } while (0)
 
 /* <element/> */
-#define empty_element(element) start_element(element) {} end_element ()
+#define empty_element(element) \
+  do { start_element(element) {} end_element (); } while (0)
 
 /* key=value attribute of the current element. */
 #define attribute(key,value)                                            \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list