aboutsummaryrefslogtreecommitdiff
path: root/tests/socket-helpers.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2020-09-08 13:48:13 +0200
committerThomas Huth <thuth@redhat.com>2020-09-16 08:41:06 +0200
commitb822c05b812a39940f78e4d020852d134d49dc99 (patch)
tree881680e93b2379d6b8da53fbb57ef2e13529f972 /tests/socket-helpers.c
parentd97b4b0d0c2313c567e88ef492f132d3e0c8df8f (diff)
downloadqemu-b822c05b812a39940f78e4d020852d134d49dc99.zip
qemu-b822c05b812a39940f78e4d020852d134d49dc99.tar.gz
qemu-b822c05b812a39940f78e4d020852d134d49dc99.tar.bz2
tests/socket-helpers: Treat EAI_NONAME as EADDRNOTAVAIL
The tests/test-char test is currently always failing on my system since the getaddrinfo() in socket_can_bind_connect() returns EAI_NONAME when it is called from socket_check_protocol_support() to check for IPv6. socket_check_protocol_support() then returns -1 and thus the tests are not run at all - even though IPv4 is working fine. socket_can_bind_connect() connect should return EADDRNOTAVAIL in this case instead, so that socket_check_protocol_support() does not fail. Suggested-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20200908121543.222872-1-thuth@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/socket-helpers.c')
-rw-r--r--tests/socket-helpers.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/socket-helpers.c b/tests/socket-helpers.c
index 19a51e8..f704fd1 100644
--- a/tests/socket-helpers.c
+++ b/tests/socket-helpers.c
@@ -59,8 +59,7 @@ static int socket_can_bind_connect(const char *hostname, int family)
/* lookup */
rc = getaddrinfo(hostname, NULL, &ai, &res);
if (rc != 0) {
- if (rc == EAI_ADDRFAMILY ||
- rc == EAI_FAMILY) {
+ if (rc == EAI_ADDRFAMILY || rc == EAI_FAMILY || rc == EAI_NONAME) {
errno = EADDRNOTAVAIL;
} else {
errno = EINVAL;