This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: Runtime.exec bug fix


Today I happened to notice that the ant cvs task didn't work in an
environment where LD_LIBRARY_PATH was not set.  I tracked this down to
a bug in the posix implementation of Runtime.exec().

Fixed as appended.  I'm checking this in on the trunk and the 3.4
branch.

Tom

Index: libjava/ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/lang/natPosixProcess.cc (startProcess): Handle case where
	PATH or LD_LIBRARY_PATH is not set in parent environment.

Index: libjava/java/lang/natPosixProcess.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natPosixProcess.cc,v
retrieving revision 1.15
diff -u -r1.15 natPosixProcess.cc
--- libjava/java/lang/natPosixProcess.cc 14 Nov 2003 01:48:30 -0000 1.15
+++ libjava/java/lang/natPosixProcess.cc 3 Feb 2004 23:58:03 -0000
@@ -1,6 +1,6 @@
 // natPosixProcess.cc - Native side of POSIX process code.
 
-/* Copyright (C) 1998, 1999, 2000, 2002, 2003  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -207,7 +207,7 @@
 	      char *path_val = getenv ("PATH");
 	      char *ld_path_val = getenv ("LD_LIBRARY_PATH");
 	      environ = env;
-	      if (getenv ("PATH") == NULL)
+	      if (path_val && getenv ("PATH") == NULL)
 		{
 		  char *path_env = (char *) _Jv_Malloc (strlen (path_val)
 							+ 5 + 1);
@@ -215,7 +215,7 @@
 		  strcat (path_env, path_val);
 		  putenv (path_env);
 		}
-	      if (getenv ("LD_LIBRARY_PATH") == NULL)
+	      if (ld_path_val && getenv ("LD_LIBRARY_PATH") == NULL)
 		{
 		  char *ld_path_env
 		    = (char *) _Jv_Malloc (strlen (ld_path_val) + 16 + 1);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]