diff options
author | Yacine Hmito <yacine.hmito@gmail.com> | 2016-02-25 22:19:33 +0100 |
---|---|---|
committer | Yacine Hmito <yacine.hmito@gmail.com> | 2016-02-25 23:04:59 +0100 |
commit | e239fbbd881f129999cac83f3cc150c16781fe3a (patch) | |
tree | 659a5a8851af893feb534355bc468e51e50009c6 /sway | |
parent | Removed p as a valid CLI option (diff) | |
download | sway-e239fbbd881f129999cac83f3cc150c16781fe3a.tar.gz sway-e239fbbd881f129999cac83f3cc150c16781fe3a.tar.zst sway-e239fbbd881f129999cac83f3cc150c16781fe3a.zip |
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.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/main.c | 3 |
1 files changed, 3 insertions, 0 deletions
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) { | |||
148 | } | 148 | } |
149 | 149 | ||
150 | if (optind < argc) { // Behave as IPC client | 150 | if (optind < argc) { // Behave as IPC client |
151 | if(optind != 1) { | ||
152 | sway_abort("Don't use options with the IPC client"); | ||
153 | } | ||
151 | if (getuid() != geteuid() || getgid() != getegid()) { | 154 | if (getuid() != geteuid() || getgid() != getegid()) { |
152 | if (setgid(getgid()) != 0 || setuid(getuid()) != 0) { | 155 | if (setgid(getgid()) != 0 || setuid(getuid()) != 0) { |
153 | sway_abort("Unable to drop root"); | 156 | sway_abort("Unable to drop root"); |