From 5dde096498a6c078901a6ea8ad922932e7693f09 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Mon, 29 Jan 2024 20:59:54 -0500 Subject: event loop: exit if the wayland socket disappears (prevents infinite loop when your compositor crashes) --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 2bedc63..39d8cea 100644 --- a/main.c +++ b/main.c @@ -549,6 +549,12 @@ main(int argc, char **argv) { if (fds[WAYLAND_FD].revents & POLLIN) { wl_display_dispatch(display); } + if (fds[WAYLAND_FD].revents & POLLERR) { + die("Exceptional condition on wayland socket.\n"); + } + if (fds[WAYLAND_FD].revents & POLLHUP) { + die("Wayland socket has been disconnected.\n"); + } if (fds[SIGNAL_FD].revents & POLLIN) { struct signalfd_siginfo si; -- cgit 1.4.1