diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-09-13 21:55:46 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-09-13 22:21:10 -0400 |
commit | 1cf737489db68312556d0a215c17e93a573b283f (patch) | |
tree | f656d72d5db60f790112689783f0950e64b2b03a /sway/commands/output | |
parent | 0b64cce73385cb739ee89c983835b098f04ee68a (diff) | |
download | sway-1cf737489db68312556d0a215c17e93a573b283f.tar.xz |
Escape spaces in background file path
Diffstat (limited to 'sway/commands/output')
-rw-r--r-- | sway/commands/output/background.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c index 8ab52a2e..2ff5f0d7 100644 --- a/sway/commands/output/background.c +++ b/sway/commands/output/background.c @@ -63,6 +63,12 @@ struct cmd_results *output_cmd_background(int argc, char **argv) { wordexp_t p; char *src = join_args(argv, j); + while (strstr(src, " ")) { + src = realloc(src, strlen(src) + 2); + char *ptr = strstr(src, " ") + 1; + memmove(ptr + 1, ptr, strlen(ptr) + 1); + *ptr = '\\'; + } if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) { struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID, "output", "Invalid syntax (%s)", src); |