diff options
author | Christian Hesse <mail@eworm.de> | 2013-10-29 10:02:52 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2013-10-29 10:02:52 +0100 |
commit | d79189f02d2cf5024e728ae9167b01209e700fdf (patch) | |
tree | 09ff457fb7cb6d5dad6911969b5d575827d3581d /pacredir.c | |
parent | 19967fe7ec5aa45aded1877b64c9aa0de2de772a (diff) | |
download | pacredir-d79189f02d2cf5024e728ae9167b01209e700fdf.tar.gz pacredir-d79189f02d2cf5024e728ae9167b01209e700fdf.tar.zst |
decide about local service via flags
Diffstat (limited to 'pacredir.c')
-rw-r--r-- | pacredir.c | 9 |
1 files changed, 1 insertions, 8 deletions
@@ -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); |