summaryrefslogtreecommitdiff
path: root/lib/libc/net/getaddrinfo.c
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-05-15 10:49:56 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2000-05-15 10:49:56 +0000
commit3dc1b0d4463753c3e4cc1ea6022f502c0fcf5e20 (patch)
tree12dcdd670fc33dbd48465fdb3bd24ebb8f32ac32 /lib/libc/net/getaddrinfo.c
parentf64b8247dc6f710d47ba664801825a80236be8ef (diff)
translate DNS error code into getaddrinfo error code (EAI_xxx). PR 1229.
Diffstat (limited to 'lib/libc/net/getaddrinfo.c')
-rw-r--r--lib/libc/net/getaddrinfo.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index 5ab29a97cc5..9cc93143270 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: getaddrinfo.c,v 1.22 2000/04/27 05:30:23 itojun Exp $ */
-/* $KAME: getaddrinfo.c,v 1.16 2000/04/27 03:37:43 itojun Exp $ */
+/* $OpenBSD: getaddrinfo.c,v 1.23 2000/05/15 10:49:55 itojun Exp $ */
+/* $KAME: getaddrinfo.c,v 1.21 2000/05/05 07:40:51 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -558,6 +558,31 @@ explore_fqdn(pai, hostname, servname, res)
}
*res = result;
return 0;
+ } else {
+ /* translate error code */
+ switch (h_errno) {
+ case NETDB_SUCCESS:
+ error = EAI_FAIL; /*XXX strange */
+ break;
+ case HOST_NOT_FOUND:
+ error = EAI_NODATA;
+ break;
+ case TRY_AGAIN:
+ error = EAI_AGAIN;
+ break;
+ case NO_RECOVERY:
+ error = EAI_FAIL;
+ break;
+ case NO_DATA:
+#if NO_ADDRESS != NO_DATA
+ case NO_ADDRESS:
+#endif
+ error = EAI_NODATA;
+ break;
+ default: /* unknown ones */
+ error = EAI_FAIL;
+ break;
+ }
}
free: