From: Dave Hart Date: Wed, 27 Jul 2011 22:13:25 +0000 (+0000) Subject: Merge shiny.ad.hartbrothers.com:C:/ntp/ntp-stable-1978 X-Git-Tag: NTP_4_2_7P197~1^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc2e96726c515a8c391d5da0059fcfc638fc6dc4;p=thirdparty%2Fntp.git Merge shiny.ad.hartbrothers.com:C:/ntp/ntp-stable-1978 into shiny.ad.hartbrothers.com:C:/ntp/ntp-dev-1976 bk: 4e308d85XEbeKJvmSSXzZEar2I2rbg --- cc2e96726c515a8c391d5da0059fcfc638fc6dc4 diff --cc ntpdc/ntpdc.c index cfdda72d3,bffaf09a0..f40b40af9 --- a/ntpdc/ntpdc.c +++ b/ntpdc/ntpdc.c @@@ -1447,16 -1504,15 +1445,15 @@@ getnetnum getnameinfo(&num->sa, SOCKLEN(num), fullhost, LENHOSTNAME, NULL, 0, 0); - } } return 1; - } else { - (void) fprintf(stderr, "***Can't find host %s\n", hname); - return 0; } - /*NOTREACHED*/ + fprintf(stderr, "***Can't find host %s\n", hname); + + return 0; } + /* * nntohost - convert network number to host name. This routine enforces * the showhostnames setting. diff --cc ntpq/ntpq.c index c350f3a1d,9ba3925da..0375d9e21 --- a/ntpq/ntpq.c +++ b/ntpq/ntpq.c @@@ -1702,16 -1847,17 +1702,16 @@@ getnetnum if (decodenetnum(hname, num)) { if (fullhost != NULL) getnameinfo(&num->sa, SOCKLEN(num), fullhost, - LENHOSTNAME, NULL, 0, 0); + LENHOSTNAME, NULL, 0, 0); return 1; } else if (getaddrinfo(hname, "ntp", &hints, &ai) == 0) { - NTP_INSIST(sizeof(*num) >= ai->ai_addrlen); + INSIST(sizeof(*num) >= ai->ai_addrlen); memcpy(num, ai->ai_addr, ai->ai_addrlen); if (fullhost != NULL) { - if (ai->ai_canonname != NULL) { - strncpy(fullhost, ai->ai_canonname, + if (ai->ai_canonname != NULL) + strlcpy(fullhost, ai->ai_canonname, LENHOSTNAME); - fullhost[LENHOSTNAME - 1] = '\0'; - } else { + else getnameinfo(&num->sa, SOCKLEN(num), fullhost, LENHOSTNAME, NULL, 0, 0);