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.
master
Yacine Hmito 9 years ago
parent 179192e222
commit e239fbbd88

@ -148,6 +148,9 @@ int main(int argc, char **argv) {
} }
if (optind < argc) { // Behave as IPC client 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 (getuid() != geteuid() || getgid() != getegid()) {
if (setgid(getgid()) != 0 || setuid(getuid()) != 0) { if (setgid(getgid()) != 0 || setuid(getuid()) != 0) {
sway_abort("Unable to drop root"); sway_abort("Unable to drop root");

Loading…
Cancel
Save