summaryrefslogtreecommitdiffstats
path: root/avahi-client
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2006-08-31 17:17:18 +0000
committerLennart Poettering <lennart@poettering.net>2006-08-31 17:17:18 +0000
commit59f3e8bef545762113c041a1ef5868e08b353045 (patch)
tree345b3d7b45f4a01c581cc340607fb3ba232a3442 /avahi-client
parent16ede7fb33fde566f43390d8dcf22d49f52c80e4 (diff)
autoconf love:
* use autoconf to check whether dbus_connection_close() is available and use it if it is, don't do those checks based on the D-Bus version. * Make use of dbus_bus_get_private() if it is available. * Since D-Bus agreeed on a cononical way to write their name, use that way in configure.ac. * Add configure options to define the UNIX user/group for avahi-autoipd git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1295 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-client')
-rw-r--r--avahi-client/client.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/avahi-client/client.c b/avahi-client/client.c
index 825e88f..f665613 100644
--- a/avahi-client/client.c
+++ b/avahi-client/client.c
@@ -67,7 +67,7 @@ static void client_set_state (AvahiClient *client, AvahiServerState state) {
switch (client->state) {
case AVAHI_CLIENT_FAILURE:
if (client->bus) {
-#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 62)
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
dbus_connection_close(client->bus);
#else
dbus_connection_disconnect(client->bus);
@@ -441,12 +441,18 @@ static int init_server(AvahiClient *client, int *ret_error) {
}
/* This function acts like dbus_bus_get but creates a private
- * connection instead. Eventually this should be replaced by a DBUS
- * provided version. */
+ * connection instead. */
static DBusConnection* avahi_dbus_bus_get(DBusError *error) {
DBusConnection *c;
- const char *a;
+#ifdef HAVE_DBUS_BUS_GET_PRIVATE
+ if (!(c = dbus_bus_get_private(DBUS_BUS_SYSTEM, error)))
+ return NULL;
+
+ dbus_connection_set_exit_on_disconnect(c, FALSE);
+#else
+ const char *a;
+
if (!(a = getenv("DBUS_SYSTEM_BUS_ADDRESS")) || !*a)
a = DBUS_SYSTEM_BUS_DEFAULT_ADDRESS;
@@ -456,10 +462,15 @@ static DBusConnection* avahi_dbus_bus_get(DBusError *error) {
dbus_connection_set_exit_on_disconnect(c, FALSE);
if (!dbus_bus_register(c, error)) {
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
dbus_connection_close(c);
+#else
+ dbus_connection_disconnect(c);
+#endif
dbus_connection_unref(c);
return NULL;
}
+#endif
return c;
}
@@ -602,7 +613,7 @@ void avahi_client_free(AvahiClient *client) {
if (client->bus)
/* Disconnect in advance, so that the free() functions won't
* issue needless server calls */
-#if (DBUS_VERSION_MAJOR == 0) && (DBUS_VERSION_MINOR >= 62)
+#ifdef HAVE_DBUS_CONNECTION_CLOSE
dbus_connection_close(client->bus);
#else
dbus_connection_disconnect(client->bus);