Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Unified Diff: runtime/bin/process_win.cc

Issue 9699032: Wrap all arguments passed to processes in "" on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/testing/bin/windows/dart.exe » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_win.cc
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc
index 397cab131ab1f8dce3101efd7ff733671a301a78..31c140cc20db5b9aa32b0fa5bbaf7a06bfe946c8 100644
--- a/runtime/bin/process_win.cc
+++ b/runtime/bin/process_win.cc
@@ -560,9 +560,9 @@ int Process::Start(const char* path,
for (int i = 0; i < arguments_length; i++) {
command_line_length += strlen(arguments[i]);
}
- // Account for two occurrences of '"' around the command, one
- // space per argument and a terminating '\0'.
- command_line_length += 2 + arguments_length + 1;
+ // Account for two occurrences of '"' around the command, one space
+ // and two occurrences of '"' per argument and a terminating '\0'.
+ command_line_length += 2 + (3 * arguments_length) + 1;
static const int kMaxCommandLineLength = 32768;
if (command_line_length > kMaxCommandLineLength) {
int error_code = SetOsErrorMessage(os_error_message, os_error_message_len);
@@ -580,7 +580,7 @@ int Process::Start(const char* path,
remaining -= written;
ASSERT(remaining >= 0);
for (int i = 0; i < arguments_length; i++) {
- written = snprintf(command_line + len, remaining, " %s", arguments[i]);
+ written = snprintf(command_line + len, remaining, " \"%s\"", arguments[i]);
len += written;
remaining -= written;
ASSERT(remaining >= 0);
« no previous file with comments | « no previous file | tools/testing/bin/windows/dart.exe » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698