From 4e3209cbbbfae0ac0afe1ce3ca847b9a73417fb8 Mon Sep 17 00:00:00 2001 From: Arvind Umrao Date: Tue, 4 Oct 2011 22:47:18 +0530 Subject: [PATCH xcb/libxcb] Fatal error message when we close libX11 window application. Fixes:https://bugs.freedesktop.org/show_bug.cgi?id=41443 When we close any libX11 window application, we get fatal error. XIO: fatal IO error 11 (Resource temporarily unavailable). Fatal error messages are strange and confusing to developers. Error is simply because we quit the application, without exiting while loop of XNextEvent. XCB should give same error messages as legacy libX11 were. In order to fix this issue, I have set right error number and made code similar to lib11:XlibInt.c:_XRead: ESET(EPIPE). I believe xcb_in.c is the best place to fix this error, rather than libX11:xcb_io.c. KCB was returning errno EAGAIN, I made it return EPIPE to make it similar to legacy libX11. Signed-off-by: Arvind Umrao --- src/xcb_in.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/xcb_in.c b/src/xcb_in.c index e075a40..eeb0f82 100644 --- a/src/xcb_in.c +++ b/src/xcb_in.c @@ -672,6 +672,7 @@ int _xcb_in_read(xcb_connection_t *c) if((n > 0) || (n < 0 && WSAGetLastError() == WSAEWOULDBLOCK)) #endif /* !_WIN32 */ return 1; + errno = EPIPE; _xcb_conn_shutdown(c); return 0; } @@ -691,6 +692,7 @@ int _xcb_in_read_block(xcb_connection_t *c, void *buf, int len) int ret = read_block(c->fd, (char *) buf + done, len - done); if(ret <= 0) { + errno = EPIPE; _xcb_conn_shutdown(c); return ret; } -- 1.7.3.2