]> git.meshlink.io Git - catta/blobdiff - avahi-daemon/static-hosts.c
* create $(localstatedir)/run if it doesn't exist
[catta] / avahi-daemon / static-hosts.c
index 23d5384f9ea80eb2b7fe6dbe15afc8da1a6ae949..8e16d8428d1061d1feae89295bc9951cf7f03547 100644 (file)
@@ -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);
@@ -221,10 +224,6 @@ void static_hosts_load(int in_chroot) {
 
 void static_hosts_free_all (void)
 {
-    StaticHost *h;
-
-    for (h = hosts; h; h = hosts->hosts_next)
-    {
-        static_host_free (h);
-    }
+    while(hosts)
+        static_host_free(hosts);
 }