diff options
author | Elliott Hughes <enh@google.com> | 2018-02-28 11:29:45 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2018-02-28 12:37:28 -0800 |
commit | 9076b0c4e78e8680ce40ce48321e8ab81a87705b (patch) | |
tree | 180da47f5ec09a0d6710feae9868aad5e33abc1e /linker/linker_utils.cpp | |
parent | bf6c0c8eaf755f5d1686b5022ee4c6d9eaf68686 (diff) |
Be clearer about linker warnings.
Explicitly say "warning" for warnings, explicitly say what action
we're going to take (such as "(ignoring)"), always provide a link to
our documentation when there is one, explicitly say what API level the
behavior changes at, and explicitly say why we're allowing the misbehavior
for now.
Bug: http://b/71852862
Test: ran tests, looked at logcat
Change-Id: I1795a5af45deb904332b866d7d666690dae4340b
Diffstat (limited to 'linker/linker_utils.cpp')
-rw-r--r-- | linker/linker_utils.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp index 5bf88e764..661e7cbc1 100644 --- a/linker/linker_utils.cpp +++ b/linker/linker_utils.cpp @@ -209,31 +209,28 @@ void resolve_paths(std::vector<std::string>& paths, const char* original_path = path.c_str(); if (realpath(original_path, resolved_path) != nullptr) { struct stat s; - if (stat(resolved_path, &s) == 0) { - if (S_ISDIR(s.st_mode)) { - resolved_paths->push_back(resolved_path); - } else { - DL_WARN("Warning: \"%s\" is not a directory (excluding from path)", resolved_path); - continue; - } - } else { - DL_WARN("Warning: cannot stat file \"%s\": %s", resolved_path, strerror(errno)); + if (stat(resolved_path, &s) == -1) { + DL_WARN("Warning: cannot stat file \"%s\": %s (ignoring)", resolved_path, strerror(errno)); + continue; + } + if (!S_ISDIR(s.st_mode)) { + DL_WARN("Warning: \"%s\" is not a directory (ignoring)", resolved_path); continue; } + resolved_paths->push_back(resolved_path); } else { - std::string zip_path; - std::string entry_path; - std::string normalized_path; - if (!normalize_path(original_path, &normalized_path)) { - DL_WARN("Warning: unable to normalize \"%s\"", original_path); + DL_WARN("Warning: unable to normalize \"%s\" (ignoring)", original_path); continue; } + std::string zip_path; + std::string entry_path; if (parse_zip_path(normalized_path.c_str(), &zip_path, &entry_path)) { if (realpath(zip_path.c_str(), resolved_path) == nullptr) { - DL_WARN("Warning: unable to resolve \"%s\": %s", zip_path.c_str(), strerror(errno)); + DL_WARN("Warning: unable to resolve \"%s\": %s (ignoring)", + zip_path.c_str(), strerror(errno)); continue; } @@ -242,4 +239,3 @@ void resolve_paths(std::vector<std::string>& paths, } } } - |