X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-core%2Fresolve-address.c;h=a278beebbb6c99d7938d6f7dd38395c7db9173dc;hb=f908520c8207124687813424eecf656ef9622bb8;hp=08168b608e1eff47ddf724782346aaeea759e9ef;hpb=3839bb837f7ed2e7cb03834469b0f35adad3ecc5;p=catta diff --git a/avahi-core/resolve-address.c b/avahi-core/resolve-address.c index 08168b6..a278bee 100644 --- a/avahi-core/resolve-address.c +++ b/avahi-core/resolve-address.c @@ -23,9 +23,12 @@ #include #endif +#include + #include #include #include +#include #include "browse.h" @@ -184,7 +187,7 @@ AvahiSAddressResolver *avahi_s_address_resolver_new( AvahiSAddressResolver *r; AvahiKey *k; - char *n; + char n[AVAHI_DOMAIN_NAME_MAX]; assert(server); assert(address); @@ -202,20 +205,9 @@ AvahiSAddressResolver *avahi_s_address_resolver_new( return NULL; } - if (address->proto == AVAHI_PROTO_INET) - n = avahi_reverse_lookup_name_ipv4(&address->data.ipv4); - else - n = avahi_reverse_lookup_name_ipv6(&address->data.ipv6); - - if (!n) { - avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); - return NULL; - } - - k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR); - avahi_free(n); + avahi_reverse_lookup_name(address, n, sizeof(n)); - if (!k) { + if (!(k = avahi_key_new(n, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR))) { avahi_server_set_errno(server, AVAHI_ERR_NO_MEMORY); return NULL; }