Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net remove unused struct def. more sanity check fo...



details:   https://anonhg.NetBSD.org/src/rev/9f3d222c3cdb
branches:  trunk
changeset: 485406:9f3d222c3cdb
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Apr 27 05:30:22 2000 +0000

description:
remove unused struct def.  more sanity check for NULL.

diffstat:

 lib/libc/net/getaddrinfo.c |  34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diffs (119 lines):

diff -r 5e0e5287ce06 -r 9f3d222c3cdb lib/libc/net/getaddrinfo.c
--- a/lib/libc/net/getaddrinfo.c        Thu Apr 27 05:28:51 2000 +0000
+++ b/lib/libc/net/getaddrinfo.c        Thu Apr 27 05:30:22 2000 +0000
@@ -1,10 +1,10 @@
-/*     $NetBSD: getaddrinfo.c,v 1.41 2000/04/26 16:08:10 itojun Exp $  */
-/*     $KAME: getaddrinfo.c,v 1.13 2000/04/26 15:41:49 itojun Exp $    */
+/*     $NetBSD: getaddrinfo.c,v 1.42 2000/04/27 05:30:22 itojun Exp $  */
+/*     $KAME: getaddrinfo.c,v 1.15 2000/04/27 03:36:25 itojun Exp $    */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -16,7 +16,7 @@
  * 3. Neither the name of the project nor the names of its contributors
  *    may be used to endorse or promote products derived from this software
  *    without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -79,7 +79,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getaddrinfo.c,v 1.41 2000/04/26 16:08:10 itojun Exp $");
+__RCSID("$NetBSD: getaddrinfo.c,v 1.42 2000/04/27 05:30:22 itojun Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -125,18 +125,11 @@
 static const char in6_addrany[] = {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };
-static const char in_loopback[] = { 127, 0, 0, 1 }; 
+static const char in_loopback[] = { 127, 0, 0, 1 };
 static const char in6_loopback[] = {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
 };
 
-struct sockinet {
-       u_char  si_len;
-       u_char  si_family;
-       u_short si_port;
-       u_int32_t si_scope_id;
-};
-
 static const struct afd {
        int a_af;
        int a_addrlen;
@@ -241,7 +234,7 @@
 #endif
 #ifdef INET6
 static int ip6_str2scopeid __P((char *, struct sockaddr_in6 *));
-#endif 
+#endif
 
 static struct addrinfo *getanswer __P((const querybuf *, int, const char *, int,
        const struct addrinfo *));
@@ -662,6 +655,8 @@
                return 0;
 
        afd = find_afd(pai->ai_family);
+       if (afd == NULL)
+               return 0;
 
        if (pai->ai_flags & AI_PASSIVE) {
                GET_AI(cur->ai_next, afd, afd->a_addrany);
@@ -714,6 +709,8 @@
                return 0;
 
        afd = find_afd(pai->ai_family);
+       if (afd == NULL)
+               return 0;
 
        switch (afd->a_af) {
 #if 0 /*X/Open spec*/
@@ -725,7 +722,7 @@
                                GET_PORT(cur->ai_next, servname);
                                while (cur && cur->ai_next)
                                        cur = cur->ai_next;
-                       } else 
+                       } else
                                ERR(EAI_FAMILY);        /*xxx*/
                }
                break;
@@ -738,7 +735,7 @@
                                GET_PORT(cur->ai_next, servname);
                                while (cur && cur->ai_next)
                                        cur = cur->ai_next;
-                       } else 
+                       } else
                                ERR(EAI_FAMILY);        /*xxx*/
                }
                break;
@@ -780,6 +777,9 @@
                return 0;
 
        afd = find_afd(pai->ai_family);
+       if (afd == NULL)
+               return 0;
+
        if (!afd->a_scoped)
                return explore_numeric(pai, hostname, servname, res);
 
@@ -1039,7 +1039,7 @@
        else
                return -1;
 }
-#endif 
+#endif
 
 /* code duplicate with gethnamaddr.c */
 



Home | Main Index | Thread Index | Old Index