aboutsummaryrefslogtreecommitdiff
path: root/win32/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/process.c')
-rw-r--r--win32/process.c34
1 files changed, 8 insertions, 26 deletions
diff --git a/win32/process.c b/win32/process.c
index b7f02e431..fda38318a 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -204,7 +204,7 @@ static intptr_t
204spawnveq(int mode, const char *path, char *const *argv, char *const *env) 204spawnveq(int mode, const char *path, char *const *argv, char *const *env)
205{ 205{
206 char **new_argv; 206 char **new_argv;
207 char *new_path = NULL; 207 char *s, *new_path = NULL;
208 int i, argc; 208 int i, argc;
209 intptr_t ret; 209 intptr_t ret;
210 struct stat st; 210 struct stat st;
@@ -229,31 +229,13 @@ spawnveq(int mode, const char *path, char *const *argv, char *const *env)
229 new_argv[i] = quote_arg(argv[i]); 229 new_argv[i] = quote_arg(argv[i]);
230 new_argv[argc] = NULL; 230 new_argv[argc] = NULL;
231 231
232 /* 232 /* Special case: spawnve won't execute a batch file if the first
233 * Special case: spawnve won't execute a batch file when the path 233 * argument is a relative path containing forward slashes. Absolute
234 * starts with a '.' and contains forward slashes. 234 * paths are fine but there's no harm in converting them too. */
235 */ 235 if (has_bat_suffix(path)) {
236 if (new_argv[0][0] == '.') { 236 for (s=new_argv[0]; *s; ++s) {
237 char *s, *p; 237 if (*s == '/')
238 238 *s = '\\';
239 if (has_bat_suffix(new_argv[0])) {
240 p = strdup(new_argv[0]);
241 }
242 else {
243 p = alloc_win32_extension(new_argv[0]);
244 }
245
246 if (p != NULL && has_bat_suffix(p)) {
247 for (s=p; *s; ++s) {
248 if (*s == '/')
249 *s = '\\';
250 }
251 if (new_argv[0] != argv[0])
252 free(new_argv[0]);
253 new_argv[0] = p;
254 }
255 else {
256 free(p);
257 } 239 }
258 } 240 }
259 241