latest patches from pr 135

This commit is contained in:
Michael Graff 2000-06-15 18:49:54 +00:00
parent e86e6bc192
commit 2193d51910
2 changed files with 14 additions and 7 deletions

View file

@ -3,7 +3,7 @@
* The Berkeley Software Design Inc. software License Agreement specifies
* the terms and conditions for redistribution.
*
* BSDI $Id: getaddrinfo.c,v 1.19 2000/06/15 18:28:09 explorer Exp $
* BSDI $Id: getaddrinfo.c,v 1.20 2000/06/15 18:49:53 explorer Exp $
*/
#include <config.h>
@ -227,6 +227,12 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
ntmp[sizeof(ntmp) - 1] = '\0';
p = strchr(ntmp, '%');
ep = NULL;
/*
* vendors may want to support non-numeric
* scopeid around here.
*/
if (p != NULL)
scopeid = (lwres_uint32_t)strtoul(p + 1,
&ep, 10);
@ -277,11 +283,12 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
SIN(ai->ai_addr)->sin_port = port;
memcpy((char *)ai->ai_addr + addroff, abuf, addrsize);
if (flags & AI_CANONNAME) {
if (ai->ai_family == AF_INET6)
SIN6(ai->ai_addr)->sin6_scope_id = scopeid;
if (ai->ai_family == AF_INET6)
SIN6(ai->ai_addr)->sin6_scope_id = scopeid;
if (lwres_getnameinfo(ai->ai_addr,
ai->ai_addrlen, nbuf, sizeof(nbuf), NULL, 0,
NI_NUMERICHOST) == 0) {
ai->ai_addrlen, nbuf, sizeof(nbuf),
NULL, 0,
NI_NUMERICHOST) == 0) {
ai->ai_canonname = strdup(nbuf);
} else {
/* XXX raise error? */

View file

@ -195,7 +195,7 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
char *p = numaddr + strlen(numaddr);
const char *stringscope = NULL;
#if 0
if (flags & NI_NUMERICSCOPE) {
if ((flags & NI_NUMERICSCOPE) == 0) {
/*
* vendors may want to add support for
* non-numeric scope identifier.
@ -203,7 +203,7 @@ lwres_getnameinfo(const struct sockaddr *sa, size_t salen, char *host,
stringscope = foo;
}
#endif
if (!stringscope) {
if (stringscope == NULL) {
snprintf(p, sizeof(numaddr) - (p - numaddr),
"%%%u",
((const struct sockaddr_in6 *)sa)->sin6_scope_id);