From 0aa3030787e0bcb18df07667544b78e3aa7fffe9 Mon Sep 17 00:00:00 2001 From: Trent Lloyd Date: Mon, 20 Feb 2006 02:33:31 +0000 Subject: * Update static hosts, fix a missing fclose(), free some leaked memory and fix indenting. * Update my bootstrap.sh magic git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1147 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/static-hosts.c | 66 ++++++++++++++++++++++++--------------------- bootstrap.sh | 4 +-- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/avahi-daemon/static-hosts.c b/avahi-daemon/static-hosts.c index aba96f7..23d5384 100644 --- a/avahi-daemon/static-hosts.c +++ b/avahi-daemon/static-hosts.c @@ -171,46 +171,52 @@ void static_hosts_load(int in_chroot) { line++; - /* Find the start of the line, ignore whitespace */ - s = ln + strspn(ln, " \t"); - /* Set the end of the string to NULL */ - s[strcspn(s, "#\r\n")] = 0; - - /* Ignore comment (#) and blank lines (*/ - if (*s == '#' || *s == 0) - continue; - - /* Read the first string (ip) up to the next whitespace */ - len = strcspn(s, " \t"); - ip = avahi_strndup(s, len); - - /* Skip past it */ - s += len; - - /* Find the next token */ - s += strspn(s, " \t"); - len = strcspn(s, " \t"); - host = avahi_strndup(s, len); - - if (*host == 0) - { - avahi_log_error ("%s:%d: Error, unexpected end of line!", filename, line); - break; - } + /* Find the start of the line, ignore whitespace */ + s = ln + strspn(ln, " \t"); + /* Set the end of the string to NULL */ + s[strcspn(s, "#\r\n")] = 0; + + /* Ignore comment (#) and blank lines (*/ + if (*s == '#' || *s == 0) + continue; + + /* Read the first string (ip) up to the next whitespace */ + len = strcspn(s, " \t"); + ip = avahi_strndup(s, len); + + /* Skip past it */ + s += len; + + /* Find the next token */ + s += strspn(s, " \t"); + len = strcspn(s, " \t"); + host = avahi_strndup(s, len); + + if (*host == 0) + { + avahi_log_error("%s:%d: Error, unexpected end of line!", filename, line); + avahi_free(host); + avahi_free(ip); + break; + } /* Skip past any more spaces */ - s += strspn(s+len, " \t"); + s += strspn(s+len, " \t"); /* Anything left? */ - if (*(s+len) != 0) { - avahi_log_error ("%s:%d: Junk on the end of the line!", filename, line); + if (*(s+len) != 0) { + avahi_log_error ("%s:%d: Junk on the end of the line!", filename, line); + avahi_free(host); + avahi_free(ip); break; - } + } h = static_host_new(); h->host = host; h->ip = ip; } + + fclose(f); } void static_hosts_free_all (void) diff --git a/bootstrap.sh b/bootstrap.sh index 870053b..d0b6256 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -51,8 +51,8 @@ case `uname -s` in esac case "$USER" in - lathiat) - FLAGS="$FLAGS" + lathiat|trentl) + FLAGS="$FLAGS --disable-qt4" ;; sebest) FLAGS="$FLAGS --disable-monodoc --disable-mono --disable-qt3 --disable-qt4 --sysconfdir=/etc --localstatedir=/var --prefix=/usr --disable-manpages --disable-xmltoman" -- cgit