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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28294 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-10-23 12:11:24 +00:00
parent ba21d401c0
commit 02e577f99a
+12 -1
View File
@@ -1261,6 +1261,17 @@ load_container(char const *name, image_type type, const char *rpath, image_t **_
// 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 @@ load_container(char const *name, image_type type, const char *rpath, image_t **_
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;
}