From 9b09cdf7dcd4cf8c32b318c44071cee4a45ecf16 Mon Sep 17 00:00:00 2001 From: Daniel Klessing Date: Wed, 9 Nov 2011 16:02:07 +0100 Subject: quote_arg(): correctly escape backslash characters --- win32/process.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/win32/process.c b/win32/process.c index cdd71182b..3ce152c45 100644 --- a/win32/process.c +++ b/win32/process.c @@ -95,6 +95,8 @@ quote_arg(const char *arg) } if (*p == '"') n += count*2 + 1; + else + n += count; continue; } len++; @@ -115,9 +117,9 @@ quote_arg(const char *arg) count++; *d++ = *arg++; } + while (count-- > 0) + *d++ = '\\'; if (*arg == '"') { - while (count-- > 0) - *d++ = '\\'; *d++ = '\\'; } } -- cgit v1.2.3-55-g6feb