diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-08-23 23:45:27 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-08-23 23:45:27 +0000 |
commit | 3b4fb60db453050f539370d75a73cba89e06e3ad (patch) | |
tree | b7158b572fe00c4cfb5ba038478fbff887619a40 /avahi-client | |
parent | bb421d3a4e8e9bbf99c340f5559e6fd76dac5196 (diff) |
* drop useless argument
* do NOT call _exit when DBUS connection dies
* don't print directly to STDOUT, that's what DBusError is for
* small optimization
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@434 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-client')
-rw-r--r-- | avahi-client/client.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/avahi-client/client.c b/avahi-client/client.c index 27f7462..837d237 100644 --- a/avahi-client/client.c +++ b/avahi-client/client.c @@ -235,14 +235,14 @@ fail: /* This function acts like dbus_bus_get but creates a private * connection instead */ static DBusConnection* -avahi_dbus_bus_get (DBusBusType type, DBusError *error) +avahi_dbus_bus_get (DBusError *error) { DBusConnection *conn; char *env_addr; env_addr = getenv ("DBUS_SYSTEM_BUS_ADDRESS"); - if (env_addr == NULL || (strcmp (env_addr, "") == 0)) + if (env_addr == NULL || (*env_addr == 0)) { env_addr = DBUS_SYSTEM_BUS_DEFAULT_ADDRESS; } @@ -250,16 +250,12 @@ avahi_dbus_bus_get (DBusBusType type, DBusError *error) conn = dbus_connection_open_private (env_addr, error); if (!conn) - { - printf ("Failed to open private connection: %s\n", error->message); return NULL; - } - dbus_connection_set_exit_on_disconnect (conn, TRUE); + dbus_connection_set_exit_on_disconnect (conn, FALSE); if (!dbus_bus_register (conn, error)) { - printf ("Failed to register connection\n"); dbus_connection_close (conn); dbus_connection_unref (conn); @@ -298,7 +294,7 @@ AvahiClient *avahi_client_new(const AvahiPoll *poll_api, AvahiClientCallback cal AVAHI_LLIST_HEAD_INIT(AvahiServiceTypeBrowser, client->service_type_browsers); AVAHI_LLIST_HEAD_INIT(AvahiServiceResolver, client->service_resolvers); - if (!(client->bus = avahi_dbus_bus_get(DBUS_BUS_SYSTEM, &error)) || + if (!(client->bus = avahi_dbus_bus_get(&error)) || dbus_error_is_set (&error)) goto fail; |