cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Error messages for threaded resolver

From: Guenter <lists_at_gknw.net>
Date: Tue, 26 Apr 2011 05:26:20 +0200

Hi Jeff,
Am 26.04.2011 02:10, schrieb Jeff Pohlmeyer:
> The attached patch stores the return value of Curl_getaddrinfo_ex() in
> tsd->sock_error and uses gai_strerror() to provide a more descriptive
> message. It assumes that gai_strerror is available if HAVE_GETADDRINFO
> is defined. I don't know if that's actually true, but it appears to be
> available for at least MS-Windows, MinGW, Linux (glibc/uClibc),
> FreeBSD, and MINIX.
NetWare doesnt have gai_strerror(), and I believe a couple more
platforms dont have it - just take a look at f.e. PostgreSQL where they
provide an own implementation for platforms which lack of it.

Also the Windows implementation is not thread-safe;
from MS PDK wstcpip.h:

// WARNING: The gai_strerror inline functions below use static buffers,
// and hence are not thread-safe. We'll use buffers long enough to hold
// 1k characters. Any system error messages longer than this will be
// returned as empty strings. However 1k should work for the error codes
// used by getaddrinfo().

see also:
http://msdn.microsoft.com/en-us/library/ms738514%28v=vs.85%29.aspx

Gün.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-26