
264 Chapter 3—DNS for IPv6
1537 }
1538 hp = getanswer(buf, n, qbuf, T_PTR, &hbuf, errp);
1539 if (!hp)
1540 continue;
1541 hbuf.h_addrtype = af;
1542 hbuf.h_length = addrlen;
1543 hbuf.h_addr_list = hlist;
1544 hlist[0] = (char *)addr;
1545 hlist[1] = NULL;
1546 return _hpcopy(&hbuf, errp);
1547 }
name6.c
1534–1536 If res_query() fails for some reason, it should return a negative value and
h_errno should have an error code. The error code is temporarily stored in *errp,
and the next top-level domain will be tried, if any.
One common error here is “host not found,” which corresponds to the Name Error
code of the DNS. In this case, h_errno should have been set ...