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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libxcb/src/xcb_conn.c b/libxcb/src/xcb_conn.c
index 7979491d3..e01d56682 100644
--- a/libxcb/src/xcb_conn.c
+++ b/libxcb/src/xcb_conn.c
@@ -36,6 +36,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
+#include <limits.h>
#include "xcb.h"
#include "xcbint.h"
@@ -209,7 +210,11 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
i++;
}
#else
- n = writev(c->fd, *vector, *count);
+ n = *count;
+ if (n > IOV_MAX)
+ n = IOV_MAX;
+
+ n = writev(c->fd, *vector, n);
if(n < 0 && errno == EAGAIN)
return 1;
#endif /* _WIN32 */