--- ntp-4.2.4p6/ntpd/ntp_intres.c.bak 2009-02-07 18:31:09.807912413 +0200 +++ ntp-4.2.4p6/ntpd/ntp_intres.c 2009-02-11 14:33:14.674546484 +0200 @@ -586,6 +586,7 @@ openntp(void) struct addrinfo hints; struct addrinfo *addrResult; const char *localhost = "127.0.0.1"; /* Use IPv6 loopback */ + int ret; if (sockfd != INVALID_SOCKET) return; @@ -598,8 +599,9 @@ openntp(void) hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; - if (getaddrinfo(localhost, "ntp", &hints, &addrResult)!=0) { - msyslog(LOG_ERR, "getaddrinfo failed: %m"); + ret = getaddrinfo(localhost, "ntp", &hints, &addrResult); + if (ret != 0) { + msyslog(LOG_ERR, "getaddrinfo failed: %s", gai_strerror(ret)); resolver_exit(1); } sockfd = socket(addrResult->ai_family, addrResult->ai_socktype, 0); --- ntp-4.2.4p6/ntpd/ntp_config.c.bak 2009-02-07 18:31:09.238913945 +0200 +++ ntp-4.2.4p6/ntpd/ntp_config.c 2009-02-11 14:24:16.883547085 +0200 @@ -2251,15 +2251,16 @@ getnetnum( (ptr->ai_family == AF_INET6 && isc_net_probeipv6() != ISC_R_SUCCESS)) { if (complain) msyslog(LOG_ERR, - "getaddrinfo: \"%s\" invalid host address, ignored", - num); + "getaddrinfo: \"%s\" invalid host address, ignored: %s", + num, gai_strerror(retval)); #ifdef DEBUG if (debug > 0) printf( - "getaddrinfo: \"%s\" invalid host address%s.\n", + "getaddrinfo: \"%s\" invalid host address%s: %s.\n", num, (complain) ? ", ignored" - : ""); + : "", + gai_strerror(retval)); #endif if (retval == 0 && ptr->ai_family == AF_INET6 && --- ntp-4.2.4p6/ntpdate/ntpdate.c.bak 2009-02-07 18:31:08.742913768 +0200 +++ ntp-4.2.4p6/ntpdate/ntpdate.c 2009-02-11 14:28:07.201550236 +0200 @@ -1829,6 +1829,7 @@ init_io(void) char service[5]; int optval = 1; int check_ntp_port_in_use = !debug && !simple_query && !unpriv_port; + int ret; /* * Init buffer free list and stat counters @@ -1849,8 +1850,9 @@ init_io(void) hints.ai_flags = AI_PASSIVE; hints.ai_socktype = SOCK_DGRAM; - if(getaddrinfo(NULL, service, &hints, &res) != 0) { - msyslog(LOG_ERR, "getaddrinfo() failed: %m"); + ret = getaddrinfo(NULL, service, &hints, &res); + if (ret != 0) { + msyslog(LOG_ERR, "getaddrinfo() failed: %s", gai_strerror(ret)); exit(1); /*NOTREACHED*/ }