Skip to content

Commit

Permalink
sway/main: fail if only one of --socket and --wayland-fd are given
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferdi265 committed Jul 19, 2024
1 parent 685a6d2 commit f938135
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions sway/main.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <fcntl.h>
#include <getopt.h>
#include <pango/pangocairo.h>
#include <signal.h>
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f938135

Please sign in to comment.