X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-daemon%2Fstatic-hosts.c;h=17b268beea535ec233e983e2d0a8fa3bc43f112d;hb=57f1965d69bf74583abe6cbff44623398407a20e;hp=ae8961b6ea3f2abe2629b32d13395f2b98b345d3;hpb=7b915095afe17e549132c1e28628b4cb26683f5e;p=catta diff --git a/avahi-daemon/static-hosts.c b/avahi-daemon/static-hosts.c index ae8961b..17b268b 100644 --- a/avahi-daemon/static-hosts.c +++ b/avahi-daemon/static-hosts.c @@ -66,11 +66,11 @@ static void entry_group_callback(AvahiServer *s, AVAHI_GCC_UNUSED AvahiSEntryGro break; case AVAHI_ENTRY_GROUP_ESTABLISHED: - avahi_log_notice ("Static Host \"%s\" successfully established.", h->host); + avahi_log_notice ("Static host name \"%s\" successfully established.", h->host); break; case AVAHI_ENTRY_GROUP_FAILURE: - avahi_log_notice ("Failed to establish Static Host \"%s\": %s.", h->host, avahi_strerror (avahi_server_errno (s))); + avahi_log_notice ("Failed to establish static host name \"%s\": %s.", h->host, avahi_strerror (avahi_server_errno (s))); break; case AVAHI_ENTRY_GROUP_UNCOMMITED: @@ -115,12 +115,12 @@ static void add_static_host_to_server(StaticHost *h) h->group = avahi_s_entry_group_new (avahi_server, entry_group_callback, h); if (!avahi_address_parse (h->ip, AVAHI_PROTO_UNSPEC, &a)) { - avahi_log_error("Static host %s: avahi_address_parse failed", h->host); + avahi_log_error("Static host name %s: avahi_address_parse failed", h->host); return; } if ((err = avahi_server_add_address(avahi_server, h->group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, h->host, &a))) { - avahi_log_error ("Static host %s: avahi_server_add_address failure: %s", h->host, avahi_strerror(err)); + avahi_log_error ("Static host name %s: avahi_server_add_address failure: %s", h->host, avahi_strerror(err)); return; } @@ -176,8 +176,8 @@ void static_hosts_load(int in_chroot) { /* Set the end of the string to NULL */ s[strcspn(s, "#\r\n")] = 0; - /* Ignore comment (#) and blank lines (*/ - if (*s == '#' || *s == 0) + /* Ignore blank lines */ + if (*s == 0) continue; /* Read the first string (ip) up to the next whitespace */ @@ -200,11 +200,14 @@ void static_hosts_load(int in_chroot) { break; } + /* Skip over the host */ + s += len; + /* Skip past any more spaces */ - s += strspn(s+len, " \t"); + s += strspn(s, " \t"); /* Anything left? */ - if (*(s+len) != 0) { + if (*s != 0) { avahi_log_error ("%s:%d: Junk on the end of the line!", filename, line); avahi_free(host); avahi_free(ip);