aboutsummaryrefslogtreecommitdiff
path: root/sway/commands/output
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-09-29 11:23:38 +0200
committerGitHub <noreply@github.com>2018-09-29 11:23:38 +0200
commit0f0d0c7f9bc4c447224aa3812c31fc596a5bde7c (patch)
tree0b32b31a765eca48ce7739de7f4b602e7c71be57 /sway/commands/output
parentdc01e884f7d71435015dd3e61f0e269a88975d8a (diff)
parent0a0cf4540ab57ba4af6fb547fd5c1a1df61fb8cf (diff)
Merge pull request #2635 from RedSoxFan/fix-bg-special
Handle shell special characters in bg file path
Diffstat (limited to 'sway/commands/output')
-rw-r--r--sway/commands/output/background.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c
index 9e370d43..30fb47c4 100644
--- a/sway/commands/output/background.c
+++ b/sway/commands/output/background.c
@@ -123,19 +123,13 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
}
free(src);
} else {
- // Escape spaces and quotes in the final path for swaybg
+ // Escape double quotes in the final path for swaybg
for (size_t i = 0; i < strlen(src); i++) {
- switch (src[i]) {
- case ' ':
- case '\'':
- case '\"':
- src = realloc(src, strlen(src) + 2);
- memmove(src + i + 1, src + i, strlen(src + i) + 1);
- *(src + i) = '\\';
- i++;
- break;
- default:
- break;
+ if (src[i] == '"') {
+ src = realloc(src, strlen(src) + 2);
+ memmove(src + i + 1, src + i, strlen(src + i) + 1);
+ *(src + i) = '\\';
+ i++;
}
}