Mercurial > hg > octave-jordi > gnulib-hg
changeset 11434:f8f0b340daef
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.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Fri, 27 Mar 2009 08:16:39 -0600 |
parents | 0f4d56f5ff5b |
children | cf3dd90a3ce0 |
files | ChangeLog modules/getaddrinfo-tests tests/test-getaddrinfo.c |
diffstat | 3 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +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.
--- a/modules/getaddrinfo-tests +++ b/modules/getaddrinfo-tests @@ -3,6 +3,7 @@ Depends-on: inet_ntop +strerror configure.ac:
--- a/tests/test-getaddrinfo.c +++ b/tests/test-getaddrinfo.c @@ -19,7 +19,9 @@ #include <config.h> #include <netdb.h> + #include <arpa/inet.h> +#include <errno.h> #include <netinet/in.h> #include <stdio.h> #include <string.h> @@ -49,6 +51,7 @@ 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 @@ hints.ai_socktype = SOCK_STREAM; res = getaddrinfo (host, service, 0, &ai0); + err = errno; dbgprintf ("res %d: %s\n", res, gai_strerror (res)); @@ -90,6 +94,9 @@ 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; }