From 179192e22292f3bdcd19e8f9d6e9e1262970bf55 Mon Sep 17 00:00:00 2001 From: Yacine Hmito Date: Thu, 25 Feb 2016 21:49:53 +0100 Subject: [PATCH 1/4] Removed p as a valid CLI option The get-socketpath long option had an undocumented short alternative as `p`. It has been removed. However, the code in the options array is still the 'p' char. --- sway/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/main.c b/sway/main.c index db2ed856..442d36ee 100644 --- a/sway/main.c +++ b/sway/main.c @@ -103,7 +103,7 @@ int main(int argc, char **argv) { int c; while (1) { int option_index = 0; - c = getopt_long(argc, argv, "hCdvVpc:", long_options, &option_index); + c = getopt_long(argc, argv, "hCdvVc:", long_options, &option_index); if (c == -1) { break; } From e239fbbd881f129999cac83f3cc150c16781fe3a Mon Sep 17 00:00:00 2001 From: Yacine Hmito Date: Thu, 25 Feb 2016 22:19:33 +0100 Subject: [PATCH 2/4] No options when using sway as IPC client Sway used to attempt sending an IPC command composed of every argument after the first non-option argument encountered. Now, raises an error if an option is encountered before the intended command. Some options such as -h or -v take effect when parsing, so they still apply. --- sway/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sway/main.c b/sway/main.c index 442d36ee..2c5144ba 100644 --- a/sway/main.c +++ b/sway/main.c @@ -148,6 +148,9 @@ int main(int argc, char **argv) { } if (optind < argc) { // Behave as IPC client + if(optind != 1) { + sway_abort("Don't use options with the IPC client"); + } if (getuid() != geteuid() || getgid() != getegid()) { if (setgid(getgid()) != 0 || setuid(getuid()) != 0) { sway_abort("Unable to drop root"); From 8db417fafe367abab6a3deb1dc8fc28d8e447b1f Mon Sep 17 00:00:00 2001 From: Yacine Hmito Date: Thu, 25 Feb 2016 22:48:36 +0100 Subject: [PATCH 3/4] Fixed swaymsg command name in sway(5) doc --- sway/sway.5.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/sway.5.txt b/sway/sway.5.txt index b54ae8da..004e0f54 100644 --- a/sway/sway.5.txt +++ b/sway/sway.5.txt @@ -16,7 +16,7 @@ startup. These commands usually consist of setting your preferences and setting key bindings. An example config is likely present in /etc/sway/config for you to check out. -All of these commands may be issued at runtime through **sway-msg**(1). +All of these commands may be issued at runtime through **swaymsg**(1). Commands -------- From c400ca8f88cc5e3f8a511e14d92a4491d9768d32 Mon Sep 17 00:00:00 2001 From: Yacine Hmito Date: Thu, 25 Feb 2016 23:13:27 +0100 Subject: [PATCH 4/4] Fix for when sway_abort doesn't exit sway_terminate does an exit in case wlc_terminate doesn't --- sway/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sway/main.c b/sway/main.c index 2c5144ba..6adbf89d 100644 --- a/sway/main.c +++ b/sway/main.c @@ -25,6 +25,7 @@ static bool terminate_request = false; void sway_terminate(void) { terminate_request = true; wlc_terminate(); + exit(EXIT_FAILURE); } void sig_handler(int signal) {