[PATCH libxcwm 08/15] Report an error, rather than just segfaulting, if the X server can't be contacted

Jon TURNEY jon.turney at dronecode.org.uk
Mon Nov 5 14:44:02 PST 2012


Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
 src/libxcwm/context.c |    5 +++++
 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;
 
-- 
1.7.9



More information about the xorg-devel mailing list