aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/natWin32Process.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/lang/natWin32Process.cc')
-rw-r--r--libjava/java/lang/natWin32Process.cc17
1 files changed, 9 insertions, 8 deletions
diff --git a/libjava/java/lang/natWin32Process.cc b/libjava/java/lang/natWin32Process.cc
index 38e6f91..ff7ddb5 100644
--- a/libjava/java/lang/natWin32Process.cc
+++ b/libjava/java/lang/natWin32Process.cc
@@ -136,21 +136,22 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
int cmdLineLen = 0;
for (int i = 0; i < progarray->length; ++i)
- cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 1);
+ cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 3);
char *cmdLine = (char *) _Jv_Malloc (cmdLineLen + 1);
+ char *cmdLineCurPos = cmdLine;
- int j = 0;
for (int i = 0; i < progarray->length; ++i)
{
+ if (i > 0)
+ *cmdLineCurPos++ = ' ';
+ *cmdLineCurPos++ = '\"';
jsize s = _Jv_GetStringUTFLength (elts[i]);
- _Jv_GetStringUTFRegion (elts[i], 0, s, (cmdLine + j));
-
- j += s;
- *(cmdLine + j) = ' ';
- j++;
+ _Jv_GetStringUTFRegion (elts[i], 0, s, cmdLineCurPos);
+ cmdLineCurPos += s;
+ *cmdLineCurPos++ = '\"';
}
- *(cmdLine + j) = '\0';
+ *cmdLineCurPos = '\0';
// Get the environment, if any.
char *env = NULL;