X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-dnsconfd%2Fmain.c;h=dafa718b5cfecc410716a8f6217ed2104505faee;hb=b200e9bab1ec8a398e07d4e3dc7698aa8b84bc6a;hp=84b0f6873cd076696c689ba85d504ecf57794084;hpb=16d9e30dd7fa052bd7e6dd37927d7f27bec90ef1;p=catta diff --git a/avahi-dnsconfd/main.c b/avahi-dnsconfd/main.c index 84b0f68..dafa718 100644 --- a/avahi-dnsconfd/main.c +++ b/avahi-dnsconfd/main.c @@ -23,11 +23,11 @@ #include #endif -#include #include #include #include #include +#include #include #include #include @@ -202,8 +202,18 @@ static char *concat_dns_servers(AvahiIfIndex interface) { for (i = servers; i; i = i->servers_next) if (i->interface == interface || interface <= 0) { + DNSServerInfo *j; char *t; + /* Filter out double entries */ + for (j = servers; j != i; j = j->servers_next) + if (j->interface == interface || interface <= 0) + if (strcmp(i->address, j->address) == 0) + break; + + if (j != i) + continue; + if (!r) t = avahi_strdup(i->address); else @@ -287,7 +297,7 @@ static int new_line(const char *l) { AvahiIfIndex interface; AvahiProtocol protocol; int i_interface, i_protocol, port; - char a[64]; + char a[AVAHI_ADDRESS_STR_MAX]; assert(state == BROWSING); @@ -296,7 +306,7 @@ static int new_line(const char *l) { return -1; } - if (sscanf(l+1, "%i %i %64s %i", &i_interface, &i_protocol, a, &port) != 4) { + if (sscanf(l+1, "%i %i %39s %i", &i_interface, &i_protocol, a, &port) != 4) { daemon_log(LOG_ERR, "Failed to parse browsing line: %s", l); return -1; } @@ -588,7 +598,7 @@ int main(int argc, char *argv[]) { /** Parent **/ if ((ret = daemon_retval_wait(20)) < 0) { - daemon_log(LOG_ERR, "Could not recieve return value from daemon process."); + daemon_log(LOG_ERR, "Could not receive return value from daemon process."); goto finish; }