From 33a68eaaf49ab1baffe652dffdd36bcf3bcb775d Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Thu, 14 Feb 2013 12:18:00 +0200 Subject: [PATCH] window: check the initial wl_display_dispatch() Check for errors in the first wl_display_dispatch() call. Otherwise doing something silly like $ WAYLAND_SOCKET=999 ./clickdot will segfault. Signed-off-by: Pekka Paalanen --- clients/window.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/clients/window.c b/clients/window.c index 404c92f1..79f9b0e2 100644 --- a/clients/window.c +++ b/clients/window.c @@ -4287,7 +4287,12 @@ display_create(int argc, char *argv[]) d->registry = wl_display_get_registry(d->display); wl_registry_add_listener(d->registry, ®istry_listener, d); - wl_display_dispatch(d->display); + + if (wl_display_dispatch(d->display) < 0) { + fprintf(stderr, "Failed to process Wayland connection: %m\n"); + return NULL; + } + #ifdef HAVE_CAIRO_EGL if (init_egl(d) < 0) fprintf(stderr, "EGL does not seem to work, "