Skip to content

Commit

Permalink
tests/socket-helpers: Treat EAI_NONAME as EADDRNOTAVAIL
Browse files Browse the repository at this point in the history
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é <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Signed-off-by: Thomas Huth <[email protected]>
  • Loading branch information
huth committed Sep 16, 2020
1 parent d97b4b0 commit b822c05
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tests/socket-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b822c05

Please sign in to comment.