diff options
author | Jiyong Park <jiyong@google.com> | 2018-11-16 21:05:10 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2018-11-16 21:05:10 +0900 |
commit | a4f3625112a011e4304da32d83ddeb2a612db79e (patch) | |
tree | 424883b603a0b94f65d8a764c1095b12bfb9177e /linker/linker_utils.cpp | |
parent | 3de3a5faaf34bd3a1b6469988eb2975038074ec2 (diff) |
Fix: search path is not added when one of its parent is not accessible
When /foo/bar/baz is added to the search paths and if getattr (stat())
is not allowed on one of its parent paths, i.e., /foo and /foo/baz, the
path was thought as non-existent and wasn't added to the search paths of
the namespace.
Fixing the bug by adding the path if the path (though not the parents)
does exist.
Bug: 119656753
Test: m apex.test; m; device boots.
Change-Id: I21bca1fee9aa20688ce9b72192d3173821ad91a3
Diffstat (limited to 'linker/linker_utils.cpp')
-rw-r--r-- | linker/linker_utils.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp index 6b9aec9fa..d08b161ca 100644 --- a/linker/linker_utils.cpp +++ b/linker/linker_utils.cpp @@ -235,6 +235,13 @@ void resolve_paths(std::vector<std::string>& paths, } resolved_paths->push_back(std::string(resolved_path) + kZipFileSeparator + entry_path); + } else { + struct stat s; + if (stat(normalized_path.c_str(), &s) == 0 && S_ISDIR(s.st_mode)) { + // Path is not a zip path, but an existing directory. Then add it + // although we failed to resolve it. b/119656753 + resolved_paths->push_back(normalized_path); + } } } } |