+2009-03-27 Eric Blake <ebb9@byu.net>
+
+ test-strerror: make debugging EAI_SYSTEM easier
+ * modules/getaddrinfo-tests (Depends-on): Add strerror.
+ * test-getaddrinfo.c (simple) [ENABLE_DEBUGGING]: Report errno if
+ failure was EAI_SYSTEM.
+
2009-03-25 Bruno Haible <bruno@clisp.org>
Fix a problem with --enable-relocatable on Solaris 7.
#include <config.h>
#include <netdb.h>
+
#include <arpa/inet.h>
+#include <errno.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
struct addrinfo hints;
struct addrinfo *ai0, *ai;
int res;
+ int err;
/* Once we skipped the test, do not try anything else */
if (skip)
hints.ai_socktype = SOCK_STREAM;
res = getaddrinfo (host, service, 0, &ai0);
+ err = errno;
dbgprintf ("res %d: %s\n", res, gai_strerror (res));
merely because of this. */
if (res == EAI_NODATA)
return 0;
+ /* Provide details if errno was set. */
+ if (res == EAI_SYSTEM)
+ dbgprintf ("system error: %s\n", strerror (err));
return 1;
}