summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-06-22 13:02:35 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-06-22 13:18:58 +0100
commit461455ca7cab93af09445d135483f5705589cc0c (patch)
tree5592c0ae3511fa786a7a95e5078a4a9569962645
parent9e7644346dc4303316e59dda13ea5b2f60549626 (diff)
downloadlibguestfs-461455ca7cab93af09445d135483f5705589cc0c.tar.gz
libguestfs-461455ca7cab93af09445d135483f5705589cc0c.tar.xz
libguestfs-461455ca7cab93af09445d135483f5705589cc0c.zip
tests/xml: Fix compilation of test on RHEL 5 with old libvirt.
Old <libvirt.h> had a conflicting definition of virDomainGetXMLDesc: fake_libvirt_xml.c:36: error: conflicting types for 'virDomainGetXMLDesc' /usr/include/libvirt/libvirt.h:715: error: previous declaration of 'virDomainGetXMLDesc' was here The difference is not material ('int' vs. 'unsigned int'). Avoid the error by not including <libvirt.h>.
-rw-r--r--tests/xml/fake_libvirt_xml.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/xml/fake_libvirt_xml.c b/tests/xml/fake_libvirt_xml.c
index c44e5fc1..61065d3d 100644
--- a/tests/xml/fake_libvirt_xml.c
+++ b/tests/xml/fake_libvirt_xml.c
@@ -25,12 +25,19 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <libvirt/libvirt.h>
-
#ifndef O_CLOEXEC
#define O_CLOEXEC 0
#endif
+/* Old <libvirt.h> had a slightly different definition of
+ * virDomainGetXMLDesc (using 'int' for flags instead of 'unsigned
+ * int'). To avoid an error trying to redefine it with a different
+ * declaration, don't include <libvirt.h> at all. Just copy enough to
+ * make the code compile.
+ */
+typedef struct _virDomain virDomain;
+typedef virDomain *virDomainPtr;
+
char *
virDomainGetXMLDesc (virDomainPtr dom, unsigned int flags)
{