X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-dnsconfd%2Fmain.c;h=1f3e3b8f2af1d1e007192a124e5e996bb40d738b;hb=c7b2f0074aae23761eb8bc6b99366e0ac6b7cf19;hp=327d73893855534b061330531a689527c00d2be7;hpb=3073103812f0ea376582eb0ff1479945a847b361;p=catta diff --git a/avahi-dnsconfd/main.c b/avahi-dnsconfd/main.c index 327d738..1f3e3b8 100644 --- a/avahi-dnsconfd/main.c +++ b/avahi-dnsconfd/main.c @@ -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; } @@ -383,6 +393,7 @@ static int parse_command_line(int argc, char *argv[]) { { "version", no_argument, NULL, 'V' }, { "refresh", no_argument, NULL, 'r' }, { "check", no_argument, NULL, 'c' }, + { NULL, 0, NULL, 0 } }; opterr = 0; @@ -408,7 +419,7 @@ static int parse_command_line(int argc, char *argv[]) { command = DAEMON_CHECK; break; default: - fprintf(stderr, "Invalid command line argument: %c\n", c); + fprintf(stderr, "Invalid command line argument: %s\n", argv[optind-1]); return -1; } }