X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-getaddrinfo.c;h=eeea3f7c432b8d7d8d6540323432b933ddf359c3;hb=b06da86eb05ed57e2861061ae5cacf4c7a3686f1;hp=5e33bb24f18260be25736c15bcf034e14e8ccb49;hpb=3de3a461b94515f6e6a3a9556ca24bb1c0e8ac91;p=gnulib.git diff --git a/tests/test-getaddrinfo.c b/tests/test-getaddrinfo.c index 5e33bb24f..eeea3f7c4 100644 --- a/tests/test-getaddrinfo.c +++ b/tests/test-getaddrinfo.c @@ -19,7 +19,9 @@ #include #include + #include +#include #include #include #include @@ -49,6 +51,7 @@ int simple (char *host, char *service) struct addrinfo hints; struct addrinfo *ai0, *ai; int res; + int err; /* Once we skipped the test, do not try anything else */ if (skip) @@ -64,6 +67,7 @@ int simple (char *host, char *service) hints.ai_socktype = SOCK_STREAM; res = getaddrinfo (host, service, 0, &ai0); + err = errno; dbgprintf ("res %d: %s\n", res, gai_strerror (res)); @@ -83,13 +87,16 @@ int simple (char *host, char *service) if (res == EAI_NONAME) return 0; /* Solaris reports EAI_SERVICE for "http" and "https". Don't - fail the test merely because of this. */ + fail the test merely because of this. */ if (res == EAI_SERVICE) return 0; /* AIX reports EAI_NODATA for "https". Don't fail the test 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; }