From 15a264e65c0df7574f2e8f2406ee6427b084cfff Mon Sep 17 00:00:00 2001 From: Evan Ralston Date: Fri, 3 Feb 2017 17:09:46 -0800 Subject: [PATCH] Log errors from loading public libraries Prevent the boot from failing silently if one of the public libraries does not exist. Test: Add invalid element to public libraries and observe log is emited during boot failure. Change-Id: I0425085a1cc081068954f327f15be853a3ccd553 --- libnativeloader/native_loader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnativeloader/native_loader.cpp b/libnativeloader/native_loader.cpp index 94c46fc19..8c2a5f7eb 100644 --- a/libnativeloader/native_loader.cpp +++ b/libnativeloader/native_loader.cpp @@ -246,7 +246,9 @@ class LibraryNamespaces { // For now we rely on CTS test to catch things like this but // it should probably be addressed in the future. for (const auto& soname : sonames) { - dlopen(soname.c_str(), RTLD_NOW | RTLD_NODELETE); + LOG_ALWAYS_FATAL_IF(dlopen(soname.c_str(), RTLD_NOW | RTLD_NODELETE) == nullptr, + "Error preloading public library %s: %s", + soname.c_str(), dlerror()); } public_libraries_ = base::Join(sonames, ':');