From: Jörg Krause Date: Thu, 24 Nov 2016 11:34:11 +0000 (+0100) Subject: mdns: avahi: set AVAHI_CLIENT_NO_FAIL in avahi_client_new() X-Git-Tag: 3.0.d18~11^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5ec3da9da8020b1ca650e2ba54e626703187663;p=thirdparty%2Fshairport-sync.git mdns: avahi: set AVAHI_CLIENT_NO_FAIL in avahi_client_new() For whatever reasons `avahi_client_new` passes the value `0` as its second parameter. However, the second parameter is of type [`AvahiClientFlags`](http://avahi.org/doxygen/html/client_8h_source.html#l00048) with the possible values: ``` c typedef enum { AVAHI_CLIENT_IGNORE_USER_CONFIG = 1, AVAHI_CLIENT_NO_FAIL = 2 } AvahiClientFlags; ``` Setting `AVAHI_CLIENT_NO_FAIL` has the benefit that the shairport-sync daemon does not depend on the order of the init process whether the avahi daemon is already up. --- diff --git a/mdns_avahi.c b/mdns_avahi.c index 12df0505..7fe6c187 100644 --- a/mdns_avahi.c +++ b/mdns_avahi.c @@ -273,7 +273,7 @@ static int avahi_register(char *srvname, int srvport) { return -1; } if (!(client = - avahi_client_new(avahi_threaded_poll_get(tpoll), 0, client_callback, NULL, &err))) { + avahi_client_new(avahi_threaded_poll_get(tpoll), AVAHI_CLIENT_NO_FAIL, client_callback, NULL, &err))) { warn("couldn't create avahi client: %s!", avahi_strerror(err)); return -1; }