diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-02-25 18:09:20 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-02-25 18:09:20 -0500 |
commit | 40b3215444ed48d2ed9bbaa00f20f266f5318f5a (patch) | |
tree | 4965c10cc32bf0159bca874c50d9a53767159a2f /sway | |
parent | 28c8e4fb9e6da839d353be723be60bb7bf2ebcdb (diff) | |
parent | c400ca8f88cc5e3f8a511e14d92a4491d9768d32 (diff) |
Merge pull request #494 from gpyh/argsegfault
Fix segfault when trying to use sway as IPC without a sway instance
Diffstat (limited to 'sway')
-rw-r--r-- | sway/main.c | 6 | ||||
-rw-r--r-- | sway/sway.5.txt | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sway/main.c b/sway/main.c index db2ed856..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) { @@ -103,7 +104,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; } @@ -148,6 +149,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"); 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 -------- |