Merge "get_executable_info: minor clarification." into main am: f789ddab1e

Original change: https://android-review.googlesource.com/c/platform/bionic/+/3061763

Change-Id: I60ac221c2e6cef35479541c159e7d93ad0432572
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Elliott Hughes 2024-04-26 15:32:42 +00:00 committed by Automerger Merge Worker
commit 1012971bba

View file

@ -221,14 +221,10 @@ static ExecutableInfo get_executable_info(const char* arg_path) {
exe_path = arg_path;
}
// Path might be a symlink
// Path might be a symlink; we need the target so that we get the right
// linker configuration later.
char sym_path[PATH_MAX];
auto ret = realpath(exe_path, sym_path);
if (ret != nullptr) {
result.path = std::string(sym_path, strlen(sym_path));
} else {
result.path = std::string(exe_path, strlen(exe_path));
}
result.path = std::string(realpath(exe_path, sym_path) != nullptr ? sym_path : exe_path);
result.phdr = reinterpret_cast<const ElfW(Phdr)*>(getauxval(AT_PHDR));
result.phdr_count = getauxval(AT_PHNUM);