summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-18 09:34:45 +0100
committerLibravatar Mikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-03-18 10:02:18 +0100
commit99f26c61a55fae97abdd2f81fb4eb971765d61fc (patch)
treeb44ffc490f74cd84f846f47a0b64a1f2d728637d
parentMerge pull request #516 from mikkeloscar/remove-panel_size (diff)
downloadsway-99f26c61a55fae97abdd2f81fb4eb971765d61fc.tar.gz
sway-99f26c61a55fae97abdd2f81fb4eb971765d61fc.tar.zst
sway-99f26c61a55fae97abdd2f81fb4eb971765d61fc.zip
Don't strip quotes from exec args
Before passing a command to a command handler the quotes are stripped from each argument in the command. This is usually the wanted behavior but causes a problem in the case of `exec` where quoted arguments can be required when passing the exec command to `/bin/sh -c`. This patch makes `exec` a special case and doesn't strip quotes from the arguments. It will just pass the exec command verbatim to the exec command handler. Fix #518
-rw-r--r--sway/commands.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 3b8556ca..ebb63691 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -362,10 +362,8 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
362 return error; 362 return error;
363 } 363 }
364 364
365 add_quotes(argv + 1, argc - 1);
366 tmp = join_args(argv + 1, argc - 1); 365 tmp = join_args(argv + 1, argc - 1);
367 } else { 366 } else {
368 add_quotes(argv, argc);
369 tmp = join_args(argv, argc); 367 tmp = join_args(argv, argc);
370 } 368 }
371 369
@@ -2869,10 +2867,12 @@ struct cmd_results *handle_command(char *_exec) {
2869 //TODO better handling of argv 2867 //TODO better handling of argv
2870 int argc; 2868 int argc;
2871 char **argv = split_args(cmd, &argc); 2869 char **argv = split_args(cmd, &argc);
2872 int i; 2870 if (strcmp(argv[0], "exec") != 0) {
2873 for (i = 1; i < argc; ++i) { 2871 int i;
2874 if (*argv[i] == '\"' || *argv[i] == '\'') { 2872 for (i = 1; i < argc; ++i) {
2875 strip_quotes(argv[i]); 2873 if (*argv[i] == '\"' || *argv[i] == '\'') {
2874 strip_quotes(argv[i]);
2875 }
2876 } 2876 }
2877 } 2877 }
2878 struct cmd_handler *handler = find_handler(argv[0], CMD_BLOCK_END); 2878 struct cmd_handler *handler = find_handler(argv[0], CMD_BLOCK_END);