static int _xcb_open_tcp(char *host, const unsigned short port)
{
int fd = -1;
- struct addrinfo hints = { AI_ADDRCONFIG | AI_NUMERICSERV, AF_UNSPEC,
- SOCK_STREAM };
+ struct addrinfo hints = { AI_ADDRCONFIG
+#ifdef AI_NUMERICSERV
+ | AI_NUMERICSERV
+#endif
+ , AF_UNSPEC, SOCK_STREAM };
char service[6]; /* "65535" with the trailing '\0' */
struct addrinfo *results, *addr;
char *bracket;
if(fd == -1)
return (xcb_connection_t *) &error_connection;
- _xcb_get_auth_info(fd, &auth);
- c = xcb_connect_to_fd(fd, &auth);
- free(auth.name);
- free(auth.data);
+ if(_xcb_get_auth_info(fd, &auth, display))
+ {
+ c = xcb_connect_to_fd(fd, &auth);
+ free(auth.name);
+ free(auth.data);
+ }
+ else
+ c = xcb_connect_to_fd(fd, 0);
return c;
}