From: Lennart Poettering Date: Tue, 23 Aug 2005 23:45:27 +0000 (+0000) Subject: * drop useless argument X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=3b4fb60db453050f539370d75a73cba89e06e3ad;p=catta * 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 --- 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;