From d79189f02d2cf5024e728ae9167b01209e700fdf Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 29 Oct 2013 10:02:52 +0100 Subject: decide about local service via flags --- pacredir.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pacredir.c b/pacredir.c index 2faab9a..3fa106a 100644 --- a/pacredir.c +++ b/pacredir.c @@ -47,7 +47,6 @@ struct hosts { /* global variables */ struct hosts * hosts = NULL; static AvahiSimplePoll *simple_poll = NULL; -char * localname = NULL; /*** get_fqdn ***/ char * get_fqdn(const char * hostname, const char * domainname) { @@ -81,7 +80,7 @@ static void browse_callback(AvahiServiceBrowser *b, AvahiIfIndex interface, Avah fprintf(stderr, "NEW: service '%s' of type '%s' in domain '%s'\n", name, type, domain); # endif - if (strcmp(host, localname) == 0) + if (flags & AVAHI_LOOKUP_RESULT_LOCAL) goto out; while (tmphosts->host != NULL) { @@ -400,9 +399,6 @@ int main(int argc, char ** argv) { goto fail; } - /* get the local hostname used by avahi */ - localname = get_fqdn(avahi_client_get_host_name(client), avahi_client_get_domain_name(client)); - /* create the service browser for PACSERVE */ if ((pacserve = avahi_service_browser_new(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, PACSERVE, NULL, 0, browse_callback, client)) == NULL) { fprintf(stderr, "Failed to create service browser: %s\n", avahi_strerror(avahi_client_errno(client))); @@ -442,9 +438,6 @@ fail: hosts = tmphosts; } - if (localname) - free(localname); - if (pacdbserve) avahi_service_browser_free(pacdbserve); -- cgit v1.2.3-54-g00ecf