Module Name: src
Committed By: christos
Date: Tue Sep 22 16:15:08 UTC 2015
Modified Files:
src/lib/libc/net: getnameinfo.c
Log Message:
be more forgiving, and don't abort on unexpected errors.
To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/lib/libc/net/getnameinfo.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/net/getnameinfo.c
diff -u src/lib/libc/net/getnameinfo.c:1.58 src/lib/libc/net/getnameinfo.c:1.59
--- src/lib/libc/net/getnameinfo.c:1.58 Tue Sep 22 10:46:09 2015
+++ src/lib/libc/net/getnameinfo.c Tue Sep 22 12:15:08 2015
@@ -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 @@ __RCSID("$NetBSD: getnameinfo.c,v 1.58 2
#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 @@ getnameinfo_inet(const struct sockaddr *
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 @@ getnameinfo_inet(const struct sockaddr *
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