Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/lib/libc/net Pull up revision 1.60 (requested by itojun...



details:   https://anonhg.NetBSD.org/src/rev/3165733f11b7
branches:  netbsd-1-6
changeset: 528325:3165733f11b7
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Jul 02 06:46:53 2002 +0000

description:
Pull up revision 1.60 (requested by itojun in ticket #417):
lint clean.  from martin husemann

diffstat:

 lib/libc/net/getaddrinfo.c |  27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diffs (86 lines):

diff -r da50172daceb -r 3165733f11b7 lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Tue Jul 02 06:34:31 2002 +0000
+++ b/lib/libc/net/getaddrinfo.c        Tue Jul 02 06:46:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getaddrinfo.c,v 1.55.2.2 2002/07/02 06:34:31 lukem Exp $       */
+/*     $NetBSD: getaddrinfo.c,v 1.55.2.3 2002/07/02 06:46:53 lukem Exp $       */
 /*     $KAME: getaddrinfo.c,v 1.29 2000/08/31 17:26:57 itojun Exp $    */
 
 /*
@@ -79,7 +79,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.55.2.2 2002/07/02 06:34:31 lukem Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.55.2.3 2002/07/02 06:46:53 lukem Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -236,7 +236,7 @@
 static int addrconfig __P((const struct addrinfo *));
 #endif
 #ifdef INET6
-static u_int32_t ip6_str2scopeid __P((char *, struct sockaddr_in6 *));
+static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *, u_int32_t *));
 #endif
 
 static struct addrinfo *getanswer __P((const querybuf *, int, const char *, int,
@@ -855,7 +855,7 @@
                        if (cur->ai_family != AF_INET6)
                                continue;
                        sin6 = (struct sockaddr_in6 *)(void *)cur->ai_addr;
-                       if ((scopeid = ip6_str2scopeid(scope, sin6)) == -1) {
+                       if (ip6_str2scopeid(scope, sin6, &scopeid) == -1) {
                                free(hostname2);
                                return(EAI_NODATA); /* XXX: is return OK? */
                        }
@@ -1059,18 +1059,19 @@
 
 #ifdef INET6
 /* convert a string to a scope identifier. XXX: IPv6 specific */
-static u_int32_t
-ip6_str2scopeid(scope, sin6)
+static int
+ip6_str2scopeid(scope, sin6, scopeid)
        char *scope;
        struct sockaddr_in6 *sin6;
+       u_int32_t *scopeid;
 {
-       u_int32_t scopeid;
        u_long lscopeid;
        struct in6_addr *a6;
        char *ep;
 
        _DIAGASSERT(scope != NULL);
        _DIAGASSERT(sin6 != NULL);
+       _DIAGASSERT(scopeid != NULL);
 
        a6 = &sin6->sin6_addr;
 
@@ -1084,10 +1085,10 @@
                 * and interfaces, so we simply use interface indices for
                 * like-local scopes.
                 */
-               scopeid = if_nametoindex(scope);
-               if (scopeid == 0)
+               *scopeid = if_nametoindex(scope);
+               if (*scopeid == 0)
                        goto trynumeric;
-               return(scopeid);
+               return 0;
        }
 
        /* still unclear about literal, allow numeric only - placeholder */
@@ -1102,9 +1103,9 @@
   trynumeric:
        errno = 0;
        lscopeid = strtoul(scope, &ep, 10);
-       scopeid = lscopeid & 0xffffffff;
-       if (errno == 0 && ep && *ep == '\0' && scopeid == lscopeid)
-               return scopeid;
+       *scopeid = (u_int32_t)(lscopeid & 0xffffffff);
+       if (errno == 0 && ep && *ep == '\0' && *scopeid == lscopeid)
+               return 0;
        else
                return -1;
 }



Home | Main Index | Thread Index | Old Index