aboutsummaryrefslogtreecommitdiff
path: root/apps/xwininfo/dsimple.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-31 15:18:29 +0200
committermarha <marha@users.sourceforge.net>2012-08-31 15:18:29 +0200
commit53192e17e55aa9ed3e3721bf4fdcb2b01a595202 (patch)
tree01d81bc7cfb5dc92584f4b7615d2ac1b09fe5411 /apps/xwininfo/dsimple.c
parent05d67ae9117e5157fd1a5175dde6d7e48caf4653 (diff)
downloadvcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.gz
vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.tar.bz2
vcxsrv-53192e17e55aa9ed3e3721bf4fdcb2b01a595202.zip
randrproto xwininfo fontconfig libxcb mesa xkeyboard-config pixman xserver
git update 31 Aug 2012
Diffstat (limited to 'apps/xwininfo/dsimple.c')
-rw-r--r--apps/xwininfo/dsimple.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/apps/xwininfo/dsimple.c b/apps/xwininfo/dsimple.c
index e6d320ed7..6432e1335 100644
--- a/apps/xwininfo/dsimple.c
+++ b/apps/xwininfo/dsimple.c
@@ -108,19 +108,38 @@ void Setup_Display_And_Screen (
xcb_connection_t **dpy, /* MODIFIED */
xcb_screen_t **screen) /* MODIFIED */
{
- int screen_number, i;
+ int screen_number, i, err;
/* Open Display */
*dpy = xcb_connect (display_name, &screen_number);
- if (xcb_connection_has_error (*dpy)) {
- Fatal_Error ("unable to open display \"%s\"",
- Get_Display_Name(display_name) );
+ if ((err = xcb_connection_has_error (*dpy)) != 0) {
+ switch (err) {
+ case XCB_CONN_CLOSED_MEM_INSUFFICIENT:
+ Fatal_Error ("Failed to allocate memory in xcb_connect");
+ case XCB_CONN_CLOSED_PARSE_ERR:
+ Fatal_Error ("unable to parse display name \"%s\"",
+ Get_Display_Name(display_name) );
+#ifdef XCB_CONN_CLOSED_INVALID_SCREEN
+ case XCB_CONN_CLOSED_INVALID_SCREEN:
+ Fatal_Error ("invalid screen %d in display \"%s\"",
+ screen_number, Get_Display_Name(display_name));
+#endif
+ default:
+ Fatal_Error ("unable to open display \"%s\"",
+ Get_Display_Name(display_name) );
+ }
}
if (screen) {
/* find our screen */
const xcb_setup_t *setup = xcb_get_setup(*dpy);
xcb_screen_iterator_t screen_iter = xcb_setup_roots_iterator(setup);
+ int screen_count = xcb_setup_roots_length(setup);
+ if (screen_count <= screen_number)
+ {
+ Fatal_Error ("unable to access screen %d, max is %d",
+ screen_number, screen_count-1 );
+ }
for (i = 0; i < screen_number; i++)
xcb_screen_next(&screen_iter);