In lwres_getaddrinfo() when checking for numeric addresses, the ntmp char array
was only initialized and used when LWRES_HAVE_SIN6_SCOPE_ID was defined,
but was declared and used outside a protective #ifdef.  I moved the
declaration and one use of it into #ifdef protection.
This commit is contained in:
Andreas Gustafsson
2000-08-03 20:23:01 +00:00
parent 60f988028d
commit 7fff7ff2da
+10 -6
View File
@@ -19,7 +19,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: getaddrinfo.c,v 1.23.2.3 2000/07/10 21:02:42 gson Exp $ */
/* $Id: getaddrinfo.c,v 1.23.2.4 2000/08/03 20:23:01 gson Exp $ */
#include <config.h>
@@ -230,15 +230,17 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
(family == 0 || (flags & AI_NUMERICHOST) != 0)) {
char abuf[sizeof(struct in6_addr)];
char nbuf[NI_MAXHOST];
char ntmp[NI_MAXHOST];
int addrsize, addroff;
#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
#ifdef LWRES_HAVE_SIN6_SCOPE_ID
char *p, *ep;
char ntmp[NI_MAXHOST];
lwres_uint32_t scopeid;
#endif
#if defined(LWRES_HAVE_SIN6_SCOPE_ID)
/* scope identifier portion */
#ifdef LWRES_HAVE_SIN6_SCOPE_ID
/*
* Scope identifier portion.
*/
ntmp[0] = '\0';
if (strchr(hostname, '%') != NULL) {
strncpy(ntmp, hostname, sizeof(ntmp) - 1);
@@ -247,7 +249,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
ep = NULL;
/*
* vendors may want to support non-numeric
* Vendors may want to support non-numeric
* scopeid around here.
*/
@@ -279,6 +281,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
addroff = (char *)(&SIN(0)->sin_addr) - (char *)0;
family = AF_INET;
goto common;
#ifdef LWRES_HAVE_SIN6_SCOPE_ID
} else if (ntmp[0] && lwres_net_pton(AF_INET6, ntmp, abuf)) {
if (family && family != AF_INET6)
return (EAI_NONAME);
@@ -286,6 +289,7 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
addroff = (char *)(&SIN6(0)->sin6_addr) - (char *)0;
family = AF_INET6;
goto common;
#endif
} else if (lwres_net_pton(AF_INET6, hostname, abuf)) {
if (family && family != AF_INET6)
return (EAI_NONAME);