More return value changes, and make _xcb_in_read_packet static since it is not called...
[free-sw/xcb/libxcb] / src / xcb_out.c
index 04b8365..62d7053 100644 (file)
@@ -199,8 +199,9 @@ int _xcb_out_write(XCBConnection *c)
     else
         n = _xcb_write(c->fd, &c->out.queue, &c->out.queue_len);
 
-    if(n < 0 && errno == EAGAIN)
-        n = 1;
+    /* XXX: should "nothing was written" be considered failure or
+     * success for this function? it's not an I/O error, but... */
+    n = (n > 0) || (n < 0 && errno == EAGAIN);
 
     if(c->out.vec_len)
     {
@@ -258,7 +259,7 @@ int _xcb_out_write_block(XCBConnection *c, struct iovec *vector, size_t count)
         c->out.vec[c->out.vec_len].iov_base = (void *) pad;
         c->out.vec[c->out.vec_len++].iov_len = XCB_PAD(vector[i].iov_len);
     }
-    if(_xcb_out_flush(c) <= 0)
+    if(!_xcb_out_flush(c))
         len = -1;
     free(c->out.vec);
     c->out.vec = 0;