From c3c2ff739853432a15f75f53744c4998a0c27455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 24 May 2021 20:51:30 +0200 Subject: [PATCH] wayland: fdm callback: check return value of wl_display_dispatch_pending() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since it’s inside a while-loop, we’d better handle failures, or we risk getting stuck. --- wayland.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wayland.c b/wayland.c index 3c0209d4..99285db3 100644 --- a/wayland.c +++ b/wayland.c @@ -1126,8 +1126,12 @@ fdm_wayl(struct fdm *fdm, int fd, int events, void *data) return false; } - while (wl_display_prepare_read(wayl->display) != 0) - wl_display_dispatch_pending(wayl->display); + while (wl_display_prepare_read(wayl->display) != 0) { + if (wl_display_dispatch_pending(wayl->display) < 0) { + LOG_ERRNO("failed to dispatch pending Wayland events"); + return false; + } + } } if (events & EPOLLHUP) {