fix blank ai_canonname from getaddrinfo for non-CNAMEs
authorRich Felker <dalias@aerifal.cx>
Sat, 2 Feb 2013 06:59:53 +0000 (01:59 -0500)
committerRich Felker <dalias@aerifal.cx>
Sat, 2 Feb 2013 06:59:53 +0000 (01:59 -0500)
src/network/getaddrinfo.c

index b341912d0215467cb832bdb6da5679205b791660..3d7b9ecd4e4b32775b38c4f84618ae12e2f20718 100644 (file)
@@ -219,7 +219,7 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
                while (j--) buf[i++].sa.sin.sin_family = AF_INET6;
        }
 
-       if (__dns_get_rr((void *)&buf[cnt], 0, 256, 1, reply, RR_CNAME, 1) < 0)
+       if (__dns_get_rr((void *)&buf[cnt], 0, 256, 1, reply, RR_CNAME, 1) <= 0)
                strcpy((void *)&buf[cnt], host);
 
        for (i=0; i<cnt; i++) {