mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:27:45 +00:00
LibELF: Add support for loading libraries from /usr/local
This commit is contained in:
parent
594d480391
commit
960079b020
1 changed files with 11 additions and 6 deletions
|
@ -99,13 +99,18 @@ static void map_library(const String& name, int fd)
|
||||||
static void map_library(const String& name)
|
static void map_library(const String& name)
|
||||||
{
|
{
|
||||||
// TODO: Do we want to also look for libs in other paths too?
|
// TODO: Do we want to also look for libs in other paths too?
|
||||||
String path = String::formatted("/usr/lib/{}", name);
|
const char* search_paths[] = { "/usr/lib/{}", "/usr/local/lib/{}" };
|
||||||
int fd = open(path.characters(), O_RDONLY);
|
for (auto& search_path : search_paths) {
|
||||||
if (fd < 0) {
|
auto path = String::formatted(search_path, name);
|
||||||
fprintf(stderr, "Could not find required shared library: %s\n", path.characters());
|
int fd = open(path.characters(), O_RDONLY);
|
||||||
VERIFY_NOT_REACHED();
|
if (fd < 0)
|
||||||
|
continue;
|
||||||
|
map_library(name, fd);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
map_library(name, fd);
|
|
||||||
|
fprintf(stderr, "Could not find required shared library: %s\n", name.characters());
|
||||||
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
static String get_library_name(const StringView& path)
|
static String get_library_name(const StringView& path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue