projects
/
free-sw
/
xcb
/
libxcb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Shut down the connection in all "fatal" error cases.
[free-sw/xcb/libxcb]
/
src
/
xcb_conn.c
diff --git
a/src/xcb_conn.c
b/src/xcb_conn.c
index
2b24dc0
..
de1f6e4
100644
(file)
--- a/
src/xcb_conn.c
+++ b/
src/xcb_conn.c
@@
-156,7
+156,10
@@
static int write_vec(XCBConnection *c, struct iovec **vector, int *count)
if(n < 0 && errno == EAGAIN)
return 1;
if(n <= 0)
if(n < 0 && errno == EAGAIN)
return 1;
if(n <= 0)
+ {
+ _xcb_conn_shutdown(c);
return 0;
return 0;
+ }
for(; *count; --*count, ++*vector)
{
for(; *count; --*count, ++*vector)
{
@@
-247,6
+250,11
@@
void XCBDisconnect(XCBConnection *c)
/* Private interface */
/* Private interface */
+void _xcb_conn_shutdown(XCBConnection *c)
+{
+ c->has_error = 1;
+}
+
int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector, int *count)
{
int ret;
int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector, int *count)
{
int ret;
@@
-275,7
+283,10
@@
int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector
ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
} while (ret == -1 && errno == EINTR);
if (ret < 0)
ret = select(c->fd + 1, &rfds, &wfds, 0, 0);
} while (ret == -1 && errno == EINTR);
if (ret < 0)
+ {
+ _xcb_conn_shutdown(c);
ret = 0;
ret = 0;
+ }
pthread_mutex_lock(&c->iolock);
if(ret)
pthread_mutex_lock(&c->iolock);
if(ret)