aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libjava/ChangeLog6
-rw-r--r--libjava/java/lang/Win32Process.java8
-rw-r--r--libjava/java/lang/natWin32Process.cc4
3 files changed, 15 insertions, 3 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index d5ebd57..dc4cef06 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,11 @@
2003-07-26 Ranjit Mathew <rmathew@hotmail.com>
+ * java/lang/Win32Process.java (ConcreteProcess): Surround
+ a command line element with quotes if it contains an
+ embedded space or tab.
+ * java/lang/natWin32Process.cc (startProcess): Do not
+ surround command line elements with quotes here.
+
* configure.host: Use -fcheck-references and
-fuse-divide-subroutine for MinGW until we fix
win32_exception_handler( ) in win32.cc w.r.t. Win32
diff --git a/libjava/java/lang/Win32Process.java b/libjava/java/lang/Win32Process.java
index b1c7e02..7a58727 100644
--- a/libjava/java/lang/Win32Process.java
+++ b/libjava/java/lang/Win32Process.java
@@ -67,6 +67,14 @@ final class ConcreteProcess extends Process
File dir)
throws IOException
{
+ for (int i = 0; i < progarray.length; i++)
+ {
+ String s = progarray[i];
+
+ if ( (s.indexOf (' ') >= 0) || (s.indexOf ('\t') >= 0))
+ progarray[i] = "\"" + s + "\"";
+ }
+
startProcess (progarray, envp, dir);
}
diff --git a/libjava/java/lang/natWin32Process.cc b/libjava/java/lang/natWin32Process.cc
index ff7ddb5..710753e 100644
--- a/libjava/java/lang/natWin32Process.cc
+++ b/libjava/java/lang/natWin32Process.cc
@@ -136,7 +136,7 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
int cmdLineLen = 0;
for (int i = 0; i < progarray->length; ++i)
- cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 3);
+ cmdLineLen += (_Jv_GetStringUTFLength (elts[i]) + 1);
char *cmdLine = (char *) _Jv_Malloc (cmdLineLen + 1);
char *cmdLineCurPos = cmdLine;
@@ -145,11 +145,9 @@ java::lang::ConcreteProcess::startProcess (jstringArray progarray,
{
if (i > 0)
*cmdLineCurPos++ = ' ';
- *cmdLineCurPos++ = '\"';
jsize s = _Jv_GetStringUTFLength (elts[i]);
_Jv_GetStringUTFRegion (elts[i], 0, s, cmdLineCurPos);
cmdLineCurPos += s;
- *cmdLineCurPos++ = '\"';
}
*cmdLineCurPos = '\0';