diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-29 08:42:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-29 08:42:03 -0400 |
commit | de9e80459a93598bdaf6a68485215ce597131d88 (patch) | |
tree | d6ba71af9572c348ac04f8415272234b890a9e7d | |
parent | 3686724c9e5fb68cc343409f1f3a9b72e1537a37 (diff) | |
parent | 79899064b6ddf4149e80948462ab0b1e722be770 (diff) |
Merge pull request #2537 from ianyfan/commands
commands: fix exec quoting
-rw-r--r-- | sway/commands/exec_always.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c index bc07c2aa..de78dd83 100644 --- a/sway/commands/exec_always.c +++ b/sway/commands/exec_always.c @@ -21,20 +21,15 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) { } char *tmp = NULL; - if (strcmp((char*)*argv, "--no-startup-id") == 0) { + if (strcmp(argv[0], "--no-startup-id") == 0) { wlr_log(WLR_INFO, "exec switch '--no-startup-id' not supported, ignored."); - if ((error = checkarg(argc - 1, "exec_always", EXPECTED_MORE_THAN, 0))) { + --argc; ++argv; + if ((error = checkarg(argc, "exec_always", EXPECTED_MORE_THAN, 0))) { return error; } - - --argc; ++argv; } - if (argv[0][0] == '\'' || argv[0][0] == '"') { - if (argc > 0) { - return cmd_results_new(CMD_INVALID, "exec_always", - "command cannot be partially quoted"); - } + if (argc == 1 && (argv[0][0] == '\'' || argv[0][0] == '"')) { tmp = strdup(argv[0]); strip_quotes(tmp); } else { |