[Haiku-commits] r28294 - haiku/trunk/src/system/runtime_loader

bonefish at BerliOS bonefish at mail.berlios.de
Thu Oct 23 14:11:24 CEST 2008


Author: bonefish
Date: 2008-10-23 14:11:24 +0200 (Thu, 23 Oct 2008)
New Revision: 28294
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28294&view=rev

Modified:
   haiku/trunk/src/system/runtime_loader/elf.cpp
Log:
When going to load a library also check whether the last path component
matches the program's image name. This is a special case for add-ons
that link against the application, with the application not having a
soname set. The concerned Pe add-ons (HeaderHeader and others) work now.


Modified: haiku/trunk/src/system/runtime_loader/elf.cpp
===================================================================
--- haiku/trunk/src/system/runtime_loader/elf.cpp	2008-10-23 09:18:05 UTC (rev 28293)
+++ haiku/trunk/src/system/runtime_loader/elf.cpp	2008-10-23 12:11:24 UTC (rev 28294)
@@ -1261,6 +1261,17 @@
 	// reload them.
 	if (type != B_ADD_ON_IMAGE) {
 		found = find_image(name, APP_OR_LIBRARY_TYPE);
+
+		if (found == NULL && type != B_APP_IMAGE) {
+			// Special case for add-ons that link against the application
+			// executable, with the executable not having a soname set.
+			if (const char* lastSlash = strrchr(name, '/')) {
+				image_t* programImage = get_program_image();
+				if (strcmp(programImage->name, lastSlash + 1) == 0)
+					found = programImage;
+			}
+		}
+
 		if (found) {
 			atomic_add(&found->ref_count, 1);
 			*_image = found;
@@ -1279,7 +1290,7 @@
 	fd = open_executable(path, type, rpath, get_program_path(),
 		sSearchPathSubDir);
 	if (fd < 0) {
-		FATAL("cannot open file %s\n", path);
+		FATAL("cannot open file %s\n", name);
 		KTRACE("rld: load_container(\"%s\"): failed to open file", name);
 		return fd;
 	}




More information about the Haiku-commits mailing list