Explorar el Código

DynamicLinker: Replace $ORIGIN with the executable path

Tim Schumacher hace 3 años
padre
commit
35e5024b7d
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      Userland/Libraries/LibELF/DynamicLinker.cpp

+ 1 - 1
Userland/Libraries/LibELF/DynamicLinker.cpp

@@ -127,7 +127,7 @@ static Result<NonnullRefPtr<DynamicLoader>, DlErrorMessage> map_library(String c
     search_paths.append("/usr/local/lib"sv);
     search_paths.append("/usr/local/lib"sv);
 
 
     for (auto const& search_path : search_paths) {
     for (auto const& search_path : search_paths) {
-        LexicalPath library_path(search_path);
+        LexicalPath library_path(search_path.replace("$ORIGIN"sv, LexicalPath::dirname(s_main_program_name)));
         int fd = open(library_path.append(name).string().characters(), O_RDONLY);
         int fd = open(library_path.append(name).string().characters(), O_RDONLY);
 
 
         if (fd < 0)
         if (fd < 0)