summaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'options.c')
-rw-r--r--options.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/options.c b/options.c
index 9731a144..a60ff515 100644
--- a/options.c
+++ b/options.c
@@ -2521,7 +2521,10 @@ char *safe_arg(const char *opt, const char *arg)
const char *f = arg;
char *t = ret + len1;
while (*f) {
- if (strchr(escapes, *f))
+ if (*f == '\\') {
+ if (!is_filename_arg || !strchr(WILD_CHARS, f[1]))
+ *t++ = '\\';
+ } else if (strchr(escapes, *f))
*t++ = '\\';
*t++ = *f++;
}