Delete a useless level of indirection from _xcb_out_send's parameters.
[free-sw/xcb/libxcb] / src / xcb_conn.c
index 251d62e..50a662b 100644 (file)
@@ -102,10 +102,7 @@ static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
     assert(count <= (int) (sizeof(parts) / sizeof(*parts)));
 
     pthread_mutex_lock(&c->iolock);
-    {
-        struct iovec *parts_ptr = parts;
-        ret = _xcb_out_send(c, &parts_ptr, &count);
-    }
+    ret = _xcb_out_send(c, parts, count);
     pthread_mutex_unlock(&c->iolock);
     return ret;
 }
@@ -210,9 +207,19 @@ 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)
+    if(!c) {
+        close(fd);
         return (xcb_connection_t *) &error_connection;
+    }
 
     c->fd = fd;