Drop AI_ADDRCONFIG when resolving TCP addresses
[free-sw/xcb/libxcb] / src / xcb_util.c
index 818746b..1bde7b7 100644 (file)
@@ -178,15 +178,13 @@ static int _xcb_open(const char *host, char *protocol, const int display)
     }
 #endif
 
-    if(*host || protocol)
+    /* If protocol or host is "unix", fall through to Unix socket code below */
+    if ((!protocol || (strcmp("unix",protocol) != 0)) &&
+        (*host != '\0') && (strcmp("unix",host) != 0))
     {
-        if (protocol
-            || strcmp("unix",host)) { /* follow the old unix: rule */
-
-            /* display specifies TCP */
-            unsigned short port = X_TCP_PORT + display;
-            return _xcb_open_tcp(host, protocol, port);
-        }
+        /* display specifies TCP */
+        unsigned short port = X_TCP_PORT + display;
+        return _xcb_open_tcp(host, protocol, port);
     }
 
 #ifndef _WIN32
@@ -279,9 +277,6 @@ static int _xcb_open_tcp(const char *host, char *protocol, const unsigned short
        host = "localhost";
 
     memset(&hints, 0, sizeof(hints));
-#ifdef AI_ADDRCONFIG
-    hints.ai_flags |= AI_ADDRCONFIG;
-#endif
 #ifdef AI_NUMERICSERV
     hints.ai_flags |= AI_NUMERICSERV;
 #endif