aboutsummaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-02-04 17:56:28 +0100
committerSimon Ser <contact@emersion.fr>2021-03-03 18:19:12 +0100
commiteec2e1d3b16ba40c85483badcc7809277274ce5d (patch)
treeed99e776dfb4f6329ccac2955d12a78ffebc2939 /xwayland
parent3504bb587daade365c11bd91568bc175b303be57 (diff)
xwayland: check executable exists on init
Instead of walking PATH like a previous proposal [1], this one checks that the Xwayland path specified in the pkg-config file exists. I think this is a reasonable compromise: - Users that don't have Xwayland installed system-wide won't get a bogus DISPLAY env variable set up. - Users that have WLR_XWAYLAND set won't be affected by this check. - Users that have Xwayland installed system-wide and a different Xwayland in their PATH still get their custom Xwayland. - Users that don't have Xwayland installed system-wide but have it somewhere else in PATH are left out. But this is pretty niche, and they can just set WLR_XWAYLAND. [1]: https://github.com/swaywm/wlroots/pull/2314
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/server.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xwayland/server.c b/xwayland/server.c
index 6a0c9fc3..f5c6b060 100644
--- a/xwayland/server.c
+++ b/xwayland/server.c
@@ -16,6 +16,7 @@
#include <wlr/xwayland.h>
#include "sockets.h"
#include "util/signal.h"
+#include "xwayland/config.h"
static void safe_close(int fd) {
if (fd >= 0) {
@@ -442,6 +443,11 @@ void wlr_xwayland_server_destroy(struct wlr_xwayland_server *server) {
struct wlr_xwayland_server *wlr_xwayland_server_create(
struct wl_display *wl_display,
struct wlr_xwayland_server_options *options) {
+ if (!getenv("WLR_XWAYLAND") && access(XWAYLAND_PATH, X_OK) != 0) {
+ wlr_log(WLR_ERROR, "Cannot find Xwayland binary \"%s\"", XWAYLAND_PATH);
+ return NULL;
+ }
+
struct wlr_xwayland_server *server =
calloc(1, sizeof(struct wlr_xwayland_server));
if (!server) {