Relative add-ons pathnames are now searched in ADDON_PATH too
if they're not found from current working directory. Fix #6427. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39661 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d037ff9fa6
commit
3986ce0335
@ -224,15 +224,24 @@ open_executable(char *name, image_type type, const char *rpath,
|
|||||||
if (strchr(name, '/')) {
|
if (strchr(name, '/')) {
|
||||||
// the name already contains a path, we don't have to search for it
|
// the name already contains a path, we don't have to search for it
|
||||||
fd = _kern_open(-1, name, O_RDONLY, 0);
|
fd = _kern_open(-1, name, O_RDONLY, 0);
|
||||||
if (fd >= 0 || type != B_LIBRARY_IMAGE)
|
if (fd >= 0 || type == B_APP_IMAGE)
|
||||||
|
return fd;
|
||||||
|
|
||||||
|
// can't search harder an absolute path add-on name!
|
||||||
|
if (type == B_ADD_ON_IMAGE && name[0] == '/')
|
||||||
return fd;
|
return fd;
|
||||||
|
|
||||||
// Even though ELF specs don't say this, we give shared libraries
|
// Even though ELF specs don't say this, we give shared libraries
|
||||||
// another chance and look them up in the usual search paths - at
|
// and relative path based add-ons another chance and look
|
||||||
|
// them up in the usual search paths - at
|
||||||
// least that seems to be what BeOS does, and since it doesn't hurt...
|
// least that seems to be what BeOS does, and since it doesn't hurt...
|
||||||
|
if (type == B_LIBRARY_IMAGE) {
|
||||||
|
// For library (but not add-on), strip any path from name
|
||||||
|
// Relative path of add-on is kept
|
||||||
paths = strrchr(name, '/') + 1;
|
paths = strrchr(name, '/') + 1;
|
||||||
memmove(name, paths, strlen(paths) + 1);
|
memmove(name, paths, strlen(paths) + 1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// let's evaluate the system path variables to find the container
|
// let's evaluate the system path variables to find the container
|
||||||
paths = search_path_for_type(type);
|
paths = search_path_for_type(type);
|
||||||
|
Loading…
Reference in New Issue
Block a user