diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-06-22 13:02:35 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-06-28 09:09:57 +0100 |
commit | 42218cc38024979a7912caae2258fa0998a9f38a (patch) | |
tree | 295cd54c2bc28b9064c8bc09ba5c86e70ec2ca9b | |
parent | ea5797bb54d96bbb6631186872b321104fef50f5 (diff) | |
download | libguestfs-42218cc38024979a7912caae2258fa0998a9f38a.tar.gz libguestfs-42218cc38024979a7912caae2258fa0998a9f38a.tar.xz libguestfs-42218cc38024979a7912caae2258fa0998a9f38a.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>.
(cherry picked from commit 461455ca7cab93af09445d135483f5705589cc0c)
-rw-r--r-- | tests/xml/fake_libvirt_xml.c | 11 |
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) { |