Revert "Use local copy of the library name on dlopen"
This reverts commit da8e591c39
.
Change-Id: I3fd6f235b18c232af5cc5ecd481851486d7d68f6
This commit is contained in:
parent
da8e591c39
commit
9fb216f844
|
@ -107,8 +107,6 @@ static const char* const kDefaultLdPaths[] = {
|
|||
#define LDPRELOAD_BUFSIZE (LDPRELOAD_MAX*64)
|
||||
#define LDPRELOAD_MAX 8
|
||||
|
||||
#define MAX_PATH_LEN 512
|
||||
|
||||
static char g_ld_library_paths_buffer[LDPATH_BUFSIZE];
|
||||
static const char* g_ld_library_paths[LDPATH_MAX + 1];
|
||||
|
||||
|
@ -752,7 +750,7 @@ ElfW(Sym)* dladdr_find_symbol(soinfo* si, const void* addr) {
|
|||
}
|
||||
|
||||
static int open_library_on_path(const char* name, const char* const paths[]) {
|
||||
char buf[MAX_PATH_LEN];
|
||||
char buf[512];
|
||||
for (size_t i = 0; paths[i] != nullptr; ++i) {
|
||||
int n = __libc_format_buffer(buf, sizeof(buf), "%s/%s", paths[i], name);
|
||||
if (n < 0 || n >= static_cast<int>(sizeof(buf))) {
|
||||
|
@ -1105,18 +1103,8 @@ soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo)
|
|||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
size_t name_len = strlen(name);
|
||||
if (name_len >= MAX_PATH_LEN) {
|
||||
DL_ERR("library name \"%s\" is too long", name);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
char local_name[name_len+1];
|
||||
strlcpy(local_name, name, name_len+1);
|
||||
|
||||
protect_data(PROT_READ | PROT_WRITE);
|
||||
soinfo* si = find_library(local_name, flags, extinfo);
|
||||
soinfo* si = find_library(name, flags, extinfo);
|
||||
if (si != nullptr) {
|
||||
si->CallConstructors();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue