From 7b4a5c44476615c1b0169e3c3b5e18810daba97e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 14 Dec 2023 11:35:15 +0100 Subject: [PATCH] Check initial wl_display_roundtrip() return value On error, print a message and exit. --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index df040e1..5057da0 100644 --- a/main.c +++ b/main.c @@ -1208,7 +1208,10 @@ int main(int argc, char **argv) { struct wl_registry *registry = wl_display_get_registry(state.display); wl_registry_add_listener(registry, ®istry_listener, &state); - wl_display_roundtrip(state.display); + if (wl_display_roundtrip(state.display) == -1) { + swaylock_log(LOG_ERROR, "wl_display_roundtrip() failed"); + return EXIT_FAILURE; + } if (!state.compositor) { swaylock_log(LOG_ERROR, "Missing wl_compositor");