Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/net be more forgiving, and don't abort on unexpecte...



details:   https://anonhg.NetBSD.org/src/rev/1c034348c590
branches:  trunk
changeset: 340648:1c034348c590
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Sep 22 16:15:08 2015 +0000

description:
be more forgiving, and don't abort on unexpected errors.

diffstat:

 lib/libc/net/getnameinfo.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (49 lines):

diff -r 06a4609b0024 -r 1c034348c590 lib/libc/net/getnameinfo.c
--- a/lib/libc/net/getnameinfo.c        Tue Sep 22 14:46:09 2015 +0000
+++ b/lib/libc/net/getnameinfo.c        Tue Sep 22 16:15:08 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getnameinfo.c,v 1.58 2015/09/22 14:46:09 christos Exp $        */
+/*     $NetBSD: getnameinfo.c,v 1.59 2015/09/22 16:15:08 christos Exp $        */
 /*     $KAME: getnameinfo.c,v 1.45 2000/09/25 22:43:56 itojun Exp $    */
 
 /*
@@ -47,7 +47,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getnameinfo.c,v 1.58 2015/09/22 14:46:09 christos Exp $");
+__RCSID("$NetBSD: getnameinfo.c,v 1.59 2015/09/22 16:15:08 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifndef RUMP_ACTION
@@ -64,7 +64,6 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <arpa/nameser.h>
-#include <stdlib.h>
 #include <assert.h>
 #include <limits.h>
 #include <netdb.h>
@@ -406,9 +405,6 @@
                        strlcpy(host, hp->h_name, hostlen);
                } else {
                        switch (he) {
-                       case NETDB_INTERNAL:
-                       case NO_RECOVERY:
-                               return EAI_SYSTEM;
                        case NO_DATA:
                        case HOST_NOT_FOUND:
                                if (flags & NI_NAMEREQD)
@@ -417,9 +413,11 @@
                        case TRY_AGAIN:
                                return EAI_AGAIN;
                        case NETDB_SUCCESS:
+                       case NETDB_INTERNAL:
+                       case NO_RECOVERY:
                                /*FALLTHROUGH*/
                        default:
-                               abort();
+                               return EAI_SYSTEM;
                        }
                        switch(afd->a_af) {
 #ifdef INET6



Home | Main Index | Thread Index | Old Index