fix dnsmasq parsing of /etc/hosts for fqdn cases like "localhost."
[openwrt-10.03/.git] / package / dnsmasq / patches / 103-hosts-fqdn.patch
1 --- dnsmasq-2.35/src/cache.c.orig       2007-02-12 14:35:58.000000000 -0800
2 +++ dnsmasq-2.35/src/cache.c    2007-02-12 14:36:51.000000000 -0800
3 @@ -720,10 +720,11 @@
4       while ((token = strtok(NULL, " \t\n\r")) && (*token != '#'))
5         {
6          struct crec *cache;
7 +        int fqdn = !!strchr(token, '.');
8          if (canonicalise(token))
9            {
10              /* If set, add a version of the name with a default domain appended */
11 -            if ((opts & OPT_EXPAND) && domain_suffix && !strchr(token, '.') && 
12 +            if ((opts & OPT_EXPAND) && domain_suffix && !fqdn && 
13                  (cache = malloc(sizeof(struct crec) + 
14                                  strlen(token)+2+strlen(domain_suffix)-SMALLDNAME)))
15                {