[libvirt] [PATCH] small compilation problem with old dbus versions

Daniel Veillard veillard at redhat.com
Fri Dec 5 14:18:04 UTC 2008


dbus_watch_get_unix_fd() was added in dbus >= 1.1.1, it deprecate
dbus_watch_get_fd(), so we should use the later if compiling against
the old stuff,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/
-------------- next part --------------
Index: src/node_device_hal.c
===================================================================
RCS file: /data/cvs/libxen/src/node_device_hal.c,v
retrieving revision 1.4
diff -u -u -p -r1.4 node_device_hal.c
--- src/node_device_hal.c	4 Dec 2008 21:48:31 -0000	1.4
+++ src/node_device_hal.c	5 Dec 2008 14:14:53 -0000
@@ -611,6 +611,7 @@ static dbus_bool_t add_dbus_watch(DBusWa
                                   void *data ATTRIBUTE_UNUSED)
 {
     int flags = 0;
+    int fd;
     struct nodeDeviceWatchInfo *info;
 
     if (VIR_ALLOC(info) < 0)
@@ -619,8 +620,13 @@ static dbus_bool_t add_dbus_watch(DBusWa
     if (dbus_watch_get_enabled(watch))
         flags = xlate_dbus_watch_flags(dbus_watch_get_flags(watch));
 
-    info->watch = virEventAddHandle(dbus_watch_get_unix_fd(watch), flags,
-                                    dbus_watch_callback, watch, NULL);
+#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) 
+    fd = dbus_watch_get_unix_fd(watch);
+#else
+    fd = dbus_watch_get_fd(watch);
+#endif
+    info->watch = virEventAddHandle(fd, flags, dbus_watch_callback,
+                                    watch, NULL);
     if (info->watch < 0) {
         VIR_FREE(info);
         return 0;


More information about the libvir-list mailing list