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
This commit is contained in:
Jiyong Park 2018-06-22 00:26:56 +09:00
parent 23f86f4f34
commit d3c08f28a3
1 changed files with 4 additions and 1 deletions

View File

@ -240,13 +240,16 @@ static bool parse_config_file(const char* ld_config_file_path,
std::string resolved_path; std::string resolved_path;
if (realpath(value.c_str(), buf)) { if (realpath(value.c_str(), buf)) {
resolved_path = buf; resolved_path = buf;
} else { } else if (errno != ENOENT) {
DL_WARN("%s:%zd: warning: path \"%s\" couldn't be resolved: %s", DL_WARN("%s:%zd: warning: path \"%s\" couldn't be resolved: %s",
ld_config_file_path, ld_config_file_path,
cp.lineno(), cp.lineno(),
value.c_str(), value.c_str(),
strerror(errno)); strerror(errno));
resolved_path = value; 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)) { if (file_is_under_dir(binary_realpath, resolved_path)) {