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) {