From 6532b0eb4921c65245e792f6db0c38d368d00d21 Mon Sep 17 00:00:00 2001 From: Ferdinand Bachmann Date: Sat, 20 Jul 2024 01:16:02 +0200 Subject: [PATCH] sway/main: fail if only one of --socket and --wayland-fd are given --- sway/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sway/main.c b/sway/main.c index f9fb04805..ba6a3d7c2 100644 --- a/sway/main.c +++ b/sway/main.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -292,6 +293,14 @@ int main(int argc, char **argv) { exit(EXIT_FAILURE); } + // Fail if only one of --socket and --wayland-fd are given. + if ((socket_name == NULL) ^ (socket_fd == -1)) { + fprintf(stderr, + "Both --socket and --wayland-fd are required for Wayland " + "socket handover, but only one was provided. Aborting.\n"); + exit(EXIT_FAILURE); + } + // As the 'callback' function for wlr_log is equivalent to that for // sway, we do not need to override it. if (debug) {