Don't emit warning on missing directories
Some directories (e.g., /product/bin, etc.) in ld.config.txt may
not exist in some devices. Since many of them are optional directories,
don't emit warning when realpath() gives ENOENT for the paths.
Test: m -j
Change-Id: Ic4fa7db05bde53d3aa5df47291e83b4cdc09aa1f
diff --git a/linker/linker_config.cpp b/linker/linker_config.cpp
index f23ae83..391c8a9 100644
--- a/linker/linker_config.cpp
+++ b/linker/linker_config.cpp
@@ -240,13 +240,16 @@
std::string resolved_path;
if (realpath(value.c_str(), buf)) {
resolved_path = buf;
- } else {
+ } else if (errno != ENOENT) {
DL_WARN("%s:%zd: warning: path \"%s\" couldn't be resolved: %s",
ld_config_file_path,
cp.lineno(),
value.c_str(),
strerror(errno));
resolved_path = value;
+ } else {
+ // ENOENT: no need to test if binary is under the path
+ continue;
}
if (file_is_under_dir(binary_realpath, resolved_path)) {