aboutsummaryrefslogtreecommitdiff
path: root/libxcb/src/xcb_conn.c
diff options
context:
space:
mode:
Diffstat (limited to 'libxcb/src/xcb_conn.c')
-rw-r--r--libxcb/src/xcb_conn.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/libxcb/src/xcb_conn.c b/libxcb/src/xcb_conn.c
index fc0a2d191..473fcf0c7 100644
--- a/libxcb/src/xcb_conn.c
+++ b/libxcb/src/xcb_conn.c
@@ -47,6 +47,8 @@
#include <netinet/in.h>
#endif /* _WIN32 */
+#include <X11/Xtrans/Xtrans.h>
+
/* SHUT_RDWR is fairly recent and is not available on all platforms */
#if !defined(SHUT_RDWR)
#define SHUT_RDWR 2
@@ -66,7 +68,7 @@ static int set_fd_flags(const int fd)
#ifdef _WIN32
u_long iMode = 1; /* non-zero puts it in non-blocking mode, 0 in blocking mode */
- int ret = 0;
+ int ret;
ret = ioctlsocket(fd, FIONBIO, &iMode);
if(ret != 0)
@@ -106,7 +108,7 @@ static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
out.authorization_protocol_name_len = 0;
out.authorization_protocol_data_len = 0;
parts[count].iov_len = sizeof(xcb_setup_request_t);
- parts[count++].iov_base = &out;
+ parts[count++].iov_base = (caddr_t) &out;
parts[count].iov_len = XCB_PAD(sizeof(xcb_setup_request_t));
parts[count++].iov_base = (char *) pad;
@@ -174,13 +176,13 @@ static int read_setup(xcb_connection_t *c)
static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
{
int n;
- assert(!c->out.queue_len);
#ifdef _WIN32
int i = 0;
int ret = 0,err = 0;
struct iovec *vec;
n = 0;
+ assert(!c->out.queue_len);
/* Could use the WSASend win32 function for scatter/gather i/o but setting up the WSABUF struct from
an iovec would require more work and I'm not sure of the benefit....works for now */
@@ -197,10 +199,11 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
}
}
n += ret;
- *vec++;
+ vec++;
i++;
}
#else
+ assert(!c->out.queue_len);
n = writev(c->fd, *vector, *count);
if(n < 0 && errno == EAGAIN)
return 1;
@@ -257,14 +260,6 @@ xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
{
xcb_connection_t* c;
-#ifndef USE_POLL
- if(fd >= FD_SETSIZE) /* would overflow in FD_SET */
- {
- close(fd);
- return (xcb_connection_t *) &error_connection;
- }
-#endif
-
c = calloc(1, sizeof(xcb_connection_t));
if(!c) {
close(fd);
@@ -373,6 +368,13 @@ int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vec
}
#else
ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
+ if (ret==SOCKET_ERROR)
+ {
+ ret=-1;
+ errno = WSAGetLastError();
+ if (errno == WSAEINTR)
+ errno=EINTR;
+ }
#endif
} while (ret == -1 && errno == EINTR);
if(ret < 0)