fix command-line construction in subprocess for Windows where an argument contains a space or quote and ends with a backslash

svn: r6163
This commit is contained in:
Matthew Flatt 2007-05-06 23:11:32 +00:00
parent ddc701ba65
commit 1947d48bd0

View File

@ -6926,7 +6926,7 @@ static char *cmdline_protect(char *s)
char *p;
int wrote_slash = 0;
naya = scheme_malloc_atomic(strlen(s) + 3 + 3*has_quote);
naya = scheme_malloc_atomic(strlen(s) + 3 + 3*has_quote + was_slash);
naya[0] = '"';
for (p = naya + 1; *s; s++) {
if (*s == '"') {
@ -6946,6 +6946,9 @@ static char *cmdline_protect(char *s)
wrote_slash = 0;
}
}
while (wrote_slash--) {
*(p++) = '\\';
}
*(p++) = '"';
*p = 0;