aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-10-29 10:02:52 +0100
committerGravatar Christian Hesse <mail@eworm.de>2013-10-29 10:02:52 +0100
commitd79189f02d2cf5024e728ae9167b01209e700fdf (patch)
tree09ff457fb7cb6d5dad6911969b5d575827d3581d
parent19967fe7ec5aa45aded1877b64c9aa0de2de772a (diff)
downloadpaccache-d79189f02d2cf5024e728ae9167b01209e700fdf.tar.gz
paccache-d79189f02d2cf5024e728ae9167b01209e700fdf.tar.zst
decide about local service via flags
-rw-r--r--pacredir.c9
1 files changed, 1 insertions, 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);