summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-10-31 12:21:51 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-21 14:02:26 +0000
commit53efa25ce7db264b54be980d1ab1088d952bbe0d (patch)
tree40faffd5f50412febb679233267c49f6c336d517 /src
parent388c8d3e63e79e288f10324c77c2914cb8acfe7f (diff)
Report an error, rather than just segfaulting, if the X server can't be contacted
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Diffstat (limited to 'src')
-rw-r--r--src/libxcwm/context.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libxcwm/context.c b/src/libxcwm/context.c
index c5bf207..65cc46e 100644
--- a/src/libxcwm/context.c
+++ b/src/libxcwm/context.c
@@ -50,6 +50,11 @@ xcwm_context_open(char *display)
conn = xcb_connect(display, &conn_screen);
+ if (xcb_connection_has_error(conn)) {
+ fprintf(stderr, "Cannot open display\n");
+ exit(1);
+ }
+
root_screen = xcb_aux_get_screen(conn, conn_screen);
root_window_id = root_screen->root;