aboutsummaryrefslogtreecommitdiff
path: root/win32/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/process.c')
-rw-r--r--win32/process.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/win32/process.c b/win32/process.c
index 53ad44a42..59bc5b4a0 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -117,7 +117,7 @@ quote_arg(const char *arg)
117 const char *p = arg; 117 const char *p = arg;
118 if (!*p) force_quotes = 1; 118 if (!*p) force_quotes = 1;
119 while (*p) { 119 while (*p) {
120 if (isspace(*p) || *p == '*' || *p == '?' || *p == '{' || *p == '\'') 120 if (isspace(*p))
121 force_quotes = 1; 121 force_quotes = 1;
122 else if (*p == '"') 122 else if (*p == '"')
123 n++; 123 n++;
@@ -130,8 +130,6 @@ quote_arg(const char *arg)
130 } 130 }
131 if (*p == '"') 131 if (*p == '"')
132 n += count*2 + 1; 132 n += count*2 + 1;
133 else
134 n += count;
135 continue; 133 continue;
136 } 134 }
137 len++; 135 len++;
@@ -142,7 +140,8 @@ quote_arg(const char *arg)
142 140
143 /* insert \ where necessary */ 141 /* insert \ where necessary */
144 d = q = xmalloc(len+n+3); 142 d = q = xmalloc(len+n+3);
145 *d++ = '"'; 143 if (force_quotes)
144 *d++ = '"';
146 while (*arg) { 145 while (*arg) {
147 if (*arg == '"') 146 if (*arg == '"')
148 *d++ = '\\'; 147 *d++ = '\\';
@@ -152,15 +151,16 @@ quote_arg(const char *arg)
152 count++; 151 count++;
153 *d++ = *arg++; 152 *d++ = *arg++;
154 } 153 }
155 while (count-- > 0)
156 *d++ = '\\';
157 if (*arg == '"') { 154 if (*arg == '"') {
155 while (count-- > 0)
156 *d++ = '\\';
158 *d++ = '\\'; 157 *d++ = '\\';
159 } 158 }
160 } 159 }
161 *d++ = *arg++; 160 *d++ = *arg++;
162 } 161 }
163 *d++ = '"'; 162 if (force_quotes)
163 *d++ = '"';
164 *d++ = 0; 164 *d++ = 0;
165 return q; 165 return q;
166} 166}