-#if DARKSTAT_USES_HOSTENT
- struct hostent *he;
-
- memcpy(&reply.addr, &ip, sizeof(reply.addr));
- he = gethostbyaddr((char *)&ip.addr.ip, sizeof(ip.addr.ip), ip.af); /* TODO MEA */
-
- /* On some platforms (for example Linux with GLIBC 2.3.3), h_errno
- * will be non-zero here even though the lookup succeeded.
- */
- if (he == NULL) {
- reply.name[0] = '\0';
- reply.error = h_errno;
- } else {
- assert(sizeof(reply.name) > sizeof(char *)); /* not just a ptr */
- strlcpy(reply.name, he->h_name, sizeof(reply.name));
- reply.error = 0;
- }
- fd_set_block(sock[CHILD]);
- xwrite(sock[CHILD], &reply, sizeof(reply));
- verbosef("DNS: %s is %s", ip_to_str(&reply.addr),
- (h_errno == 0)?reply.name:hstrerror(h_errno));
-#else /* !DARKSTAT_USES_HOSTENT */