]> git.meshlink.io Git - catta/blobdiff - avahi-client/client.c
* Fix error handling in avahi-client so that it actually reports the
[catta] / avahi-client / client.c
index 93d768a85bef970558ccc8959fa57a1110f1991a..cbc3004f645f44b3c60706c2b4bab455d50cf29c 100644 (file)
@@ -233,6 +233,7 @@ static int get_server_state(AvahiClient *client, int *ret_error) {
 
     client_set_state(client, (AvahiServerState) state);
 
+    *ret_error = AVAHI_OK;
     return AVAHI_OK;
 
 fail:
@@ -363,6 +364,10 @@ AvahiClient *avahi_client_new(const AvahiPoll *poll_api, AvahiClientCallback cal
     if (!(dbus_bus_name_has_owner(client->bus, AVAHI_DBUS_NAME, &error)) ||
         dbus_error_is_set(&error)) {
 
+        /* We free the error so its not set, that way the fail target
+         * will return the NO_DAEMON error rather than a DBUS error */
+        dbus_error_free (&error);
+
         if (ret_error)
             *ret_error = AVAHI_ERR_NO_DAEMON;