diff options
Diffstat (limited to 'ext/socket')
-rw-r--r-- | ext/socket/getaddrinfo.c | 16 | ||||
-rw-r--r-- | ext/socket/getnameinfo.c | 8 |
2 files changed, 12 insertions, 12 deletions
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c index a4f01c0405..3382f00e52 100644 --- a/ext/socket/getaddrinfo.c +++ b/ext/socket/getaddrinfo.c @@ -114,7 +114,7 @@ static const struct afd { int a_socklen; int a_off; const char *a_addrany; - const char *a_loopback; + const char *a_loopback; } afdl [] = { #ifdef INET6 #define N_INET6 0 @@ -145,7 +145,7 @@ static int get_name __P((const char *, const struct afd *, static int get_addr __P((const char *, int, struct addrinfo **, struct addrinfo *, int)); static int str_isnumber __P((const char *)); - + static const char *const ai_errlist[] = { "success.", "address family for hostname not supported.", /* EAI_ADDRFAMILY */ @@ -302,7 +302,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h pai->ai_addr = NULL; pai->ai_next = NULL; port = ANY; - + if (hostname == NULL && servname == NULL) return EAI_NONAME; if (hints) { @@ -409,7 +409,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h ERR(EAI_PROTOCOL); /*xxx*/ } } - + /* * hostname == NULL. * passive socket -> anyaddr (0.0.0.0 or ::) @@ -458,7 +458,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h else ERR(EAI_FAMILY); } - + /* hostname as numeric name */ for (i = 0; afdl[i].a_af; i++) { if (inet_pton(afdl[i].a_af, hostname, pton)) { @@ -484,7 +484,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h break; #endif } - + if (pai->ai_family == afdl[i].a_af || pai->ai_family == PF_UNSPEC) { if (! (pai->ai_flags & AI_CANONNAME)) { @@ -549,7 +549,7 @@ get_name(const char *addr, const struct afd *afd, struct addrinfo **res, char *n GET_CANONNAME(cur, hp->h_name); } else GET_AI(cur, afd, numaddr, port); - + #ifdef INET6 if (hp) freehostent(hp); @@ -612,7 +612,7 @@ get_addr(const char *hostname, int af, struct addrinfo **res, struct addrinfo *p if ((hp->h_name == NULL) || (hp->h_name[0] == 0) || (hp->h_addr_list[0] == NULL)) ERR(EAI_FAIL); - + for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) { switch (af) { #ifdef INET6 diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c index fca3bcfcc8..3ee83eb2a0 100644 --- a/ext/socket/getnameinfo.c +++ b/ext/socket/getnameinfo.c @@ -156,7 +156,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho len = SA_LEN(sa); if (len != salen) return ENI_SALEN; - + family = sa->sa_family; for (i = 0; afdl[i].a_af; i++) if (afdl[i].a_af == family) { @@ -164,10 +164,10 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho goto found; } return ENI_FAMILY; - + found: if (len != afd->a_socklen) return ENI_SALEN; - + port = ((struct sockinet *)sa)->si_port; /* network byte order */ addr = (char *)sa + afd->a_off; @@ -199,7 +199,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho flags |= NI_NUMERICHOST; v4a >>= IN_CLASSA_NSHIFT; if (v4a == 0) - flags |= NI_NUMERICHOST; + flags |= NI_NUMERICHOST; break; #ifdef INET6 case AF_INET6: |