X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_out.c;h=1b68215a8c3d20d64fddba17bb19c6bdd8fcf2bd;hb=2c8b5994b3fbba343199ef555594a32e29d8bcee;hp=56e02f78e3c69f8ea9ed28e76dc1162e4c24b7aa;hpb=f74487e34fd61d11a501c07030f8fd7ed8caeb1c;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_out.c b/src/xcb_out.c index 56e02f7..1b68215 100644 --- a/src/xcb_out.c +++ b/src/xcb_out.c @@ -59,6 +59,8 @@ static int write_block(XCBConnection *c, struct iovec *vector, int count) CARD32 XCBGetMaximumRequestLength(XCBConnection *c) { + if(c->has_error) + return 0; pthread_mutex_lock(&c->out.reqlenlock); if(!c->out.maximum_request_length) { @@ -91,6 +93,9 @@ unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, c int veclen = req->count; enum workarounds workaround = WORKAROUND_NONE; + if(c->has_error) + return 0; + assert(c != 0); assert(vector != 0); assert(req->count > 0); @@ -107,7 +112,10 @@ unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, c { const XCBQueryExtensionRep *extension = XCBGetExtensionData(c, req->ext); if(!(extension && extension->present)) + { + _xcb_conn_shutdown(c); return 0; + } ((CARD8 *) vector[0].iov_base)[0] = extension->major_opcode; ((CARD8 *) vector[0].iov_base)[1] = req->opcode; } @@ -134,7 +142,10 @@ unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, c longlen = 0; } else if(longlen > XCBGetMaximumRequestLength(c)) + { + _xcb_conn_shutdown(c); return 0; /* server can't take this; maybe need BIGREQUESTS? */ + } /* set the length field. */ ((CARD16 *) vector[0].iov_base)[1] = shortlen; @@ -192,7 +203,10 @@ unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, c } if(!write_block(c, vector, veclen)) + { + _xcb_conn_shutdown(c); request = 0; + } pthread_mutex_unlock(&c->iolock); return request; } @@ -200,6 +214,8 @@ unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, c int XCBFlush(XCBConnection *c) { int ret; + if(c->has_error) + return 0; pthread_mutex_lock(&c->iolock); ret = _xcb_out_flush_to(c, c->out.request); pthread_mutex_unlock(&c->iolock);