projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test-fopen-safer: split from test-fopen
[gnulib.git]
/
tests
/
test-getaddrinfo.c
diff --git
a/tests/test-getaddrinfo.c
b/tests/test-getaddrinfo.c
index
a8b2fd5
..
eeea3f7
100644
(file)
--- a/
tests/test-getaddrinfo.c
+++ b/
tests/test-getaddrinfo.c
@@
-19,7
+19,9
@@
#include <config.h>
#include <netdb.h>
#include <config.h>
#include <netdb.h>
+
#include <arpa/inet.h>
#include <arpa/inet.h>
+#include <errno.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
#include <stdio.h>
#include <string.h>
@@
-45,9
+47,15
@@
int simple (char *host, char *service)
{
char buf[BUFSIZ];
int simple (char *host, char *service)
{
char buf[BUFSIZ];
+ static int skip = 0;
struct addrinfo hints;
struct addrinfo *ai0, *ai;
int res;
struct addrinfo hints;
struct addrinfo *ai0, *ai;
int res;
+ int err;
+
+ /* Once we skipped the test, do not try anything else */
+ if (skip)
+ return 0;
dbgprintf ("Finding %s service %s...\n", host, service);
dbgprintf ("Finding %s service %s...\n", host, service);
@@
-59,6
+67,7
@@
int simple (char *host, char *service)
hints.ai_socktype = SOCK_STREAM;
res = getaddrinfo (host, service, 0, &ai0);
hints.ai_socktype = SOCK_STREAM;
res = getaddrinfo (host, service, 0, &ai0);
+ err = errno;
dbgprintf ("res %d: %s\n", res, gai_strerror (res));
dbgprintf ("res %d: %s\n", res, gai_strerror (res));
@@
-69,6
+78,7
@@
int simple (char *host, char *service)
in-law's farm. */
if (res == EAI_AGAIN)
{
in-law's farm. */
if (res == EAI_AGAIN)
{
+ skip++;
fprintf (stderr, "skipping getaddrinfo test: no network?\n");
return 77;
}
fprintf (stderr, "skipping getaddrinfo test: no network?\n");
return 77;
}
@@
-77,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
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;
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;
}
return 1;
}