summaryrefslogtreecommitdiff
path: root/lib/asyn-thread.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2011-04-27 13:20:27 +0200
committerDaniel Stenberg <daniel@haxx.se>2011-04-28 15:25:03 +0200
commit5b7e1f9efede93b7bf97b31052bc0908f184db51 (patch)
tree70ccc7cecfd27ac3c15f6e3156c4fc3db057c662 /lib/asyn-thread.c
parentc33aee1667bd037068674bd354ffd0feb1d13de1 (diff)
downloadcurl-5b7e1f9efede93b7bf97b31052bc0908f184db51.tar.gz
gai_strerror: provide private implementation
There are systems (like NetWare) without its own gai_strerror() function.
Diffstat (limited to 'lib/asyn-thread.c')
-rw-r--r--lib/asyn-thread.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index 689eb9583..da9dacc43 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -415,6 +415,44 @@ static bool init_resolve_thread (struct connectdata *conn,
return FALSE;
}
+#if defined(HAVE_GETADDRINFO) && !defined(HAVE_GAI_STRERROR) && !defined(WIN32)
+/* NetWare has getaddrinfo but lacks gai_strerror.
+ Windows has a gai_strerror but it is bad (not thread-safe) and the generic
+ socket error string function can be used for this pupose. */
+static const char *gai_strerror(int ecode)
+{
+ switch (ecode){
+ case EAI_AGAIN:
+ return "The name could not be resolved at this time";
+ case EAI_BADFLAGS:
+ return "The flags parameter had an invalid value";
+ case EAI_FAIL:
+ return "A non-recoverable error occurred when attempting to "
+ "resolve the name";
+ case EAI_FAMILY:
+ return "The address family was not recognized";
+ case EAI_MEMORY:
+ return "Out of memory";
+ case EAI_NONAME:
+ return "The name does not resolve for the supplied parameters";
+ case EAI_SERVICE:
+ return "The service passed was not recognized for the "
+ "specified socket type"
+ case EAI_SOCKTYPE:
+ return "The intended socket type was not recognized"
+ case EAI_SYSTEM:
+ return "A system error occurred";
+ case EAI_OVERFLOW:
+ return "An argument buffer overflowed";
+ default:
+ return "Unknown error";
+
+/* define this now as this is a private implementation of said function */
+#define HAVE_GAI_STRERROR
+}
+#endif
+
+
/*
* resolver_error() calls failf() with the appropriate message after a resolve
* error