Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Windows spawner fixes.

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/ChangeLog,v
retrieving revision 1.3
diff -u -r1.3 ChangeLog
--- ChangeLog	7 Nov 2002 20:45:03 -0000	1.3
+++ ChangeLog	19 Nov 2002 18:53:09 -0000
@@ -1,5 +1,11 @@
 2002-11-06 Alex Chapiro
 
+	* library/Win32ProcessEx.c:
+	This is a fixing of Bug 25808. New binary attached.
+	* os/win32/x86/spawner.dll: Recompiled.
+
+2002-11-06 Alex Chapiro
+
 	* library/Win32ProcessEx.c (GetJVMProc): Removed.
 	This is a fixing of Bug 25808.
 	Remove not portable fragment of code (conversion start directory to native
Index: library/Win32ProcessEx.c
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/library/Win32ProcessEx.c,v
retrieving revision 1.4
diff -u -r1.4 Win32ProcessEx.c
--- library/Win32ProcessEx.c	7 Nov 2002 20:45:17 -0000	1.4
+++ library/Win32ProcessEx.c	19 Nov 2002 18:53:09 -0000
@@ -22,7 +22,7 @@
 #include "jni.h"
 #include "io.h"
 
-#define DEBUG_MONITOR
+// #define DEBUG_MONITOR
 
 #define PIPE_SIZE 512
 #define MAX_CMD_SIZE 1024
@@ -156,15 +156,18 @@
 		jsize    len = (*env) -> GetStringUTFLength(env, item);
 		int nCpyLen;
 		const char *  str = (*env) -> GetStringUTFChars(env, item, 0);	
-		if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, MAX_CMD_SIZE - nPos)))
+		if(NULL != str)
 			{
-			ThrowByName(env, "java/Exception", "Too long command line");
-			return 0;
+			if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, MAX_CMD_SIZE - nPos)))
+				{
+				ThrowByName(env, "java/Exception", "Too long command line");
+				return 0;
+				}
+			nPos += nCpyLen;
+			szCmdLine[nPos] = ' ';
+			++nPos;
+			(*env) -> ReleaseStringUTFChars(env, item, str);
 			}
-		nPos += nCpyLen;
-		szCmdLine[nPos] = ' ';
-		++nPos;
-		(*env) -> ReleaseStringUTFChars(env, item, str);
 		}
 
 	szCmdLine[nPos] = '\0';
@@ -178,15 +181,18 @@
 			jsize    len = (*env) -> GetStringUTFLength(env, item);
 			int nCpyLen;
 			const char *  str = (*env) -> GetStringUTFChars(env, item, 0);	
-			if(0 > (nCpyLen = copyTo(szEnvBlock + nPos, str, len, MAX_ENV_SIZE - nPos - 1)))
+			if(NULL != str)
 				{
-				ThrowByName(env, "java/Exception", "Too many environment variables");
-				return 0;
+				if(0 > (nCpyLen = copyTo(szEnvBlock + nPos, str, len, MAX_ENV_SIZE - nPos - 1)))
+					{
+					ThrowByName(env, "java/Exception", "Too many environment variables");
+					return 0;
+					}
+				nPos += nCpyLen;
+				szEnvBlock[nPos] = '\0';
+				++nPos;
+				(*env) -> ReleaseStringUTFChars(env, item, str);
 				}
-			nPos += nCpyLen;
-			szEnvBlock[nPos] = '\0';
-			++nPos;
-			(*env) -> ReleaseStringUTFChars(env, item, str);
 			}
     	szEnvBlock[nPos] = '\0';
 		envBlk = szEnvBlock;
@@ -196,9 +202,12 @@
 
     if (dir != 0) 
 		{ 
-		const char * str = NULL;
-		cwd = strdup((*env) -> GetStringUTFChars(env, dir, 0));
-		(*env) -> ReleaseStringUTFChars(env, dir, str);
+		const char * str = (*env) -> GetStringUTFChars(env, dir, 0);
+		if(NULL != str)
+			{
+			cwd = strdup(str);
+			(*env) -> ReleaseStringUTFChars(env, dir, str);
+			}
 		}
 
 
@@ -355,15 +364,18 @@
 		jsize    len = (*env) -> GetStringUTFLength(env, item);
 		int nCpyLen;
 		const char *  str = (*env) -> GetStringUTFChars(env, item, 0);	
-		if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, MAX_CMD_SIZE - nPos)))
+		if(NULL != str)
 			{
-			ThrowByName(env, "java/Exception", "Too long command line");
-			return 0;
+			if(0 > (nCpyLen = copyTo(szCmdLine + nPos, str, len, MAX_CMD_SIZE - nPos)))
+				{
+				ThrowByName(env, "java/Exception", "Too long command line");
+				return 0;
+				}
+			nPos += nCpyLen;
+			szCmdLine[nPos] = ' ';
+			++nPos;
+			(*env) -> ReleaseStringUTFChars(env, item, str);
 			}
-		nPos += nCpyLen;
-		szCmdLine[nPos] = ' ';
-		++nPos;
-		(*env) -> ReleaseStringUTFChars(env, item, str);
 		}
 
 	szCmdLine[nPos] = '\0';
@@ -377,15 +389,18 @@
 			jsize    len = (*env) -> GetStringUTFLength(env, item);
 			int nCpyLen;
 			const char *  str = (*env) -> GetStringUTFChars(env, item, 0);	
-			if(0 > (nCpyLen = copyTo(szEnvBlock + nPos, str, len, MAX_ENV_SIZE - nPos - 1)))
+			if(NULL != str)
 				{
-				ThrowByName(env, "java/Exception", "Too many environment variables");
-				return 0;
+				if(0 > (nCpyLen = copyTo(szEnvBlock + nPos, str, len, MAX_ENV_SIZE - nPos - 1)))
+					{
+					ThrowByName(env, "java/Exception", "Too many environment variables");
+					return 0;
+					}
+				nPos += nCpyLen;
+				szEnvBlock[nPos] = '\0';
+				++nPos;
+				(*env) -> ReleaseStringUTFChars(env, item, str);
 				}
-			nPos += nCpyLen;
-			szEnvBlock[nPos] = '\0';
-			++nPos;
-			(*env) -> ReleaseStringUTFChars(env, item, str);
 			}
     	szEnvBlock[nPos] = '\0';
 		envBlk = szEnvBlock;
@@ -395,9 +410,12 @@
 
     if (dir != 0) 
 		{ 
-		const char * str = NULL;
-		cwd = strdup((*env) -> GetStringUTFChars(env, dir, 0));
-		(*env) -> ReleaseStringUTFChars(env, dir, str);
+		const char * str = (*env) -> GetStringUTFChars(env, dir, 0);
+		if(NULL != str) 
+			{
+			cwd = strdup(str);
+			(*env) -> ReleaseStringUTFChars(env, dir, str);
+			}
 		}
 
 
Index: os/win32/x86/spawner.dll
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.win32/os/win32/x86/spawner.dll,v
retrieving revision 1.6
diff -u -r1.6 spawner.dll
Binary files /tmp/cvsYBCO5t and spawner.dll differ



Back to the top