Check initial wl_display_roundtrip() return value

On error, print a message and exit.
This commit is contained in:
Simon Ser 2023-12-14 11:35:15 +01:00 committed by Kenny Levinsen
parent 9b4b390588
commit 7b4a5c4447

5
main.c
View File

@ -1208,7 +1208,10 @@ int main(int argc, char **argv) {
struct wl_registry *registry = wl_display_get_registry(state.display); struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state); wl_registry_add_listener(registry, &registry_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) { if (!state.compositor) {
swaylock_log(LOG_ERROR, "Missing wl_compositor"); swaylock_log(LOG_ERROR, "Missing wl_compositor");