[kaffe] CVS kaffe (guilhem): Removed verbose library loading to fix errors on some systems.

Kaffe CVS cvs-commits at kaffe.org
Mon Jan 10 08:58:45 PST 2005


PatchSet 5832 
Date: 2005/01/10 12:43:14
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Removed verbose library loading to fix errors on some systems.

        * kaffe/kaffevm/external.c
        (loadNativeLibrary): Removed verbose code as it produces wrong error
        on many systems.

        * libraries/clib/native/Runtime.c
        (linkLibrary): Do not throw exception anymore. The java library will
        take care of it.

Members: 
	ChangeLog:1.3376->1.3377 
	kaffe/kaffevm/external.c:1.77->1.78 
	libraries/clib/native/Runtime.c:1.30->1.31 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3376 kaffe/ChangeLog:1.3377
--- kaffe/ChangeLog:1.3376	Mon Jan 10 10:30:16 2005
+++ kaffe/ChangeLog	Mon Jan 10 12:43:14 2005
@@ -1,5 +1,15 @@
 2005-01-10  Guilhem Lavaux  <guilhem at kaffe.org>
 
+	* kaffe/kaffevm/external.c
+	(loadNativeLibrary): Removed verbose code as it produces wrong error
+	on many systems.
+
+	* libraries/clib/native/Runtime.c
+	(linkLibrary): Do not throw exception anymore. The java library will
+	take care of it.
+
+2005-01-10  Guilhem Lavaux  <guilhem at kaffe.org>
+
 	* kaffe/kaffevm/jit/machine.c,
 	kaffe/kaffevm/jit3/machine.c
 	(finishInsnSequence): Align the constant pool on 8 bytes (sizeof(union
Index: kaffe/kaffe/kaffevm/external.c
diff -u kaffe/kaffe/kaffevm/external.c:1.77 kaffe/kaffe/kaffevm/external.c:1.78
--- kaffe/kaffe/kaffevm/external.c:1.77	Sat Jan  1 08:45:58 2005
+++ kaffe/kaffe/kaffevm/external.c	Mon Jan 10 12:43:19 2005
@@ -266,38 +266,8 @@
 				const char *err = KaffeLib_GetError();
 
 				DBG(NATIVELIB, dprintf("Error loading %s: %s\n", path, err); );
-				
-				/* XXX Bleh, silly guessing system. */
-				if( err == 0 )
-				{
-					if (errbuf != 0)
-						strncpy(errbuf,
-							"Unknown error",
-							errsiz);
-				}
-				else if( (strstr(err, " not found") ||
-					  strstr(err, "annot open") ||
-					  strstr(err, "an't open")) )
-				{
-                                char *last_sep = strrchr (path, file_separator[0]);
-#ifdef HAVE_SNPRINTF
-                                snprintf (errbuf, errsiz, "%s: not found.\n%s",
-                                          last_sep==NULL?path:last_sep+1,
-					  err);
-#else
-                                /* possible buffer overflow problem */
-                                if(errbuf != 0)
-                                    sprintf (errbuf, "%s: not found.\n%s",
-                                          last_sep==NULL?path:last_sep+1,
-					  err);
-#endif
-				}
-				else
-				{
-					/* We'll assume its a real error. */
-					if (errbuf != 0)
-						strncpy(errbuf, err, errsiz);
-				}
+
+				strncpy(errbuf, err, errsiz);
 			
 				unlockStaticMutex(&libraryLock);
 				return -1;
Index: kaffe/libraries/clib/native/Runtime.c
diff -u kaffe/libraries/clib/native/Runtime.c:1.30 kaffe/libraries/clib/native/Runtime.c:1.31
--- kaffe/libraries/clib/native/Runtime.c:1.30	Tue Dec 21 16:51:15 2004
+++ kaffe/libraries/clib/native/Runtime.c	Mon Jan 10 12:43:19 2005
@@ -144,8 +144,8 @@
 
 
 /*
- * Attempt to link in a shared library. Throws an UnsatisfiedLinkError
- * if the attempt fails.
+ * Attempt to link in a shared library. Return false
+ * if the attempt fails, true otherwise.
  */
 jboolean
 java_lang_Runtime_linkLibrary(struct Hjava_lang_String *jpath, struct Hjava_lang_ClassLoader* loader)
@@ -156,19 +156,7 @@
 
 	stringJava2CBuf(jpath, path, sizeof(path));
 	if (loadNativeLibrary(path, loader, errbuf, sizeof(errbuf)) < 0) {
- 		if( strstr(errbuf, ": not found") ) {
-			/* simply proceed if file was not found, java part
-			 * will throw an exception later if library could
-			 * not be found.
-			 */
-			return false;
- 		} else {
-			postExceptionMessage(&einfo, 
-					     JAVA_LANG(UnsatisfiedLinkError),
-					     "%s",
-					     errbuf);
-			throwError(&einfo);
-		}
+		return false;
 	}
 	return true;
 }




More information about the kaffe mailing list