Skip to contentSkip to conversation

tests/socket-helpers: Treat EAI_NONAME as EADDRNOTAVAIL

PATCH In review Thomas Huth 2 participants 2 messages Sep 8, 2020 – Sep 9, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tests/socket-helpers.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tests/socket-helpers.c +1 -2
index 19a51e887e..f704fd1a69 100644
@@ -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;
Signature · 1 line
2.18.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Thomas Huth

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.

Quoted 5 lines
---
 tests/socket-helpers.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|