From 8252b7b1a496adeab18e7fdf78b506efcfde823c Mon Sep 17 00:00:00 2001 From: Jente Hidskes Date: Sat, 25 Jan 2020 22:51:15 +0100 Subject: [PATCH] Cage: check if XDG_RUNTIME_DIR is set Wayland requires this environment variable to be set, see https://manpages.debian.org/experimental/libwayland-doc/wl_display_connect.3.en.html --- cage.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cage.c b/cage.c index b911370..9526e82 100644 --- a/cage.c +++ b/cage.c @@ -194,6 +194,12 @@ main(int argc, char *argv[]) wlr_log_init(WLR_ERROR, NULL); #endif + /* Wayland requires XDG_RUNTIME_DIR to be set. */ + if (!getenv("XDG_RUNTIME_DIR")) { + wlr_log(WLR_ERROR, "XDG_RUNTIME_DIR is not set in the environment"); + return 1; + } + server.wl_display = wl_display_create(); if (!server.wl_display) { wlr_log(WLR_ERROR, "Cannot allocate a Wayland display");