Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/net lint clean. from martin husemann
details: https://anonhg.NetBSD.org/src/rev/609e9d1ffe8e
branches: trunk
changeset: 533489:609e9d1ffe8e
user: itojun <itojun%NetBSD.org@localhost>
date: Mon Jul 01 21:05:56 2002 +0000
description:
lint clean. from martin husemann
diffstat:
lib/libc/net/getaddrinfo.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diffs (86 lines):
diff -r e6a1f463b10a -r 609e9d1ffe8e lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c Mon Jul 01 20:55:30 2002 +0000
+++ b/lib/libc/net/getaddrinfo.c Mon Jul 01 21:05:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getaddrinfo.c,v 1.59 2002/07/01 07:42:49 itojun Exp $ */
+/* $NetBSD: getaddrinfo.c,v 1.60 2002/07/01 21:05:56 itojun 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.59 2002/07/01 07:42:49 itojun Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.60 2002/07/01 21:05:56 itojun 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