#include <stdio.h>
#include <stdlib.h>
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
#include <assert.h>
-#include <sys/types.h>
#ifndef WINDOWS
# include <sys/socket.h>
#include "hash.h"
#include "connect.h" /* for socket_has_inet6 */
-#ifndef errno
-extern int errno;
-#endif
-
-#ifndef h_errno
-# ifndef __CYGWIN__
-extern int h_errno;
-# endif
-#endif
-
#ifndef NO_ADDRESS
# define NO_ADDRESS NO_DATA
#endif
++al->refcount;
hash_table_put (host_name_addresses_map, xstrdup_lower (host), al);
-#ifdef ENABLE_DEBUG
- if (opt.debug)
+ IF_DEBUG
{
int i;
debug_logprintf ("Caching %s =>", host);
debug_logprintf (" %s", pretty_print_address (al->addresses + i));
debug_logprintf ("\n");
}
-#endif
}
/* Remove HOST from the DNS cache. Does nothing is HOST is not in
else if (opt.ipv6_only)
hints.ai_family = AF_INET6;
else
- /* We used to specify AI_ADDRCONFIG here, but removed it because
- it fails in on systems with IPv6 loopbacks, it loses on AIX
- 5.1, and isn't really needed as we sort the addresses). */
+ /* We tried using AI_ADDRCONFIG, but removed it because: it
+ misinterprets IPv6 loopbacks, it is broken on AIX 5.1, and
+ it's unneeded since we sort the addresses anyway. */
hints.ai_family = AF_UNSPEC;
if (flags & LH_BIND)