You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ge...@apache.org on 2006/12/13 12:52:55 UTC
svn commit: r486606 -
/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
Author: geirm
Date: Wed Dec 13 03:52:49 2006
New Revision: 486606
URL: http://svn.apache.org/viewvc?view=rev&rev=486606
Log:
Fixed bug w/ crash as "java" in win32, and also
added wait for child completion so Tim won't be
so perturbed :)
Modified:
harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
Modified: harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c?view=diff&rev=486606&r1=486605&r2=486606
==============================================================================
--- harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c (original)
+++ harmony/enhanced/jdktools/trunk/modules/samsa/src/main/native/samsa/samsa.c Wed Dec 13 03:52:49 2006
@@ -78,7 +78,7 @@
PROCESS_INFORMATION procInfo;
STARTUPINFO startInfo;
#endif
- int myArgvCount = argc + 4;
+ int myArgvCount = argc;
char **myArgv = (char **) malloc(sizeof(char*) * myArgvCount);
char *toolName = NULL;
int i, j;
@@ -143,6 +143,8 @@
char *buffer;
int size;
int i;
+
+ myArgvCount = argc + 4;
size = (strlen(jdkRoot) + strlen(LIB_POSTFIX)) * pToolData->numJars +
strlen(CLASSPATH_SEP) * (pToolData->numJars - 1) + 1;
@@ -215,10 +217,8 @@
strcpy(toolName, fullExePath);
strcat(toolName, " ");
- strcat(toolName,myArgv[1]);
- strcat(toolName, " ");
- for (i=2; i < myArgvCount; i++) {
+ for (i=1; i < myArgvCount; i++) {
if (myArgv[i] != NULL) {
strcat(toolName,myArgv[i]);
strcat(toolName, " ");
@@ -232,8 +232,17 @@
memset(&startInfo, 0, sizeof(STARTUPINFO));
startInfo.cb = sizeof(STARTUPINFO);
- CreateProcess(NULL, toolName, NULL, NULL,
- FALSE, 0, NULL, NULL, &startInfo, &procInfo);
+ if (CreateProcess(NULL, toolName, NULL, NULL,
+ FALSE, 0, NULL, NULL, &startInfo, &procInfo)) {
+
+ WaitForSingleObject( procInfo.hProcess, INFINITE );
+
+ CloseHandle(procInfo.hProcess);
+ CloseHandle(procInfo.hThread);
+ }
+ else {
+ fprintf(stderr, "Error creating process : %d\n", GetLastError());
+ }
#else
execv(fullExePath, myArgv);
#endif