diff options
| author | 2018-05-11 12:19:20 +0000 | |
|---|---|---|
| committer | 2018-05-11 12:19:20 +0000 | |
| commit | 9d93cd6518633be803cc140b51d0ad5093fc25f2 (patch) | |
| tree | 8619f55be46f787e4347435f436ace283e8dbc06 /runtime/base/file_utils.cc | |
| parent | da1e6d2a8d41c130eefbb4ad3b828f2cd1470529 (diff) | |
| parent | 0d0f3164160e50ddb78022f662c5438fc167f50d (diff) | |
Merge "Handle multidex in LocationIsOnSystemFramework."
Diffstat (limited to 'runtime/base/file_utils.cc')
| -rw-r--r-- | runtime/base/file_utils.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/runtime/base/file_utils.cc b/runtime/base/file_utils.cc index 7921985b15..537216c198 100644 --- a/runtime/base/file_utils.cc +++ b/runtime/base/file_utils.cc @@ -261,12 +261,12 @@ std::string ReplaceFileExtension(const std::string& filename, const std::string& } } -bool LocationIsOnSystem(const char* location) { - UniqueCPtr<const char[]> path(realpath(location, nullptr)); - return path != nullptr && android::base::StartsWith(path.get(), GetAndroidRoot().c_str()); +bool LocationIsOnSystem(const char* path) { + UniqueCPtr<const char[]> full_path(realpath(path, nullptr)); + return path != nullptr && android::base::StartsWith(full_path.get(), GetAndroidRoot().c_str()); } -bool LocationIsOnSystemFramework(const char* location) { +bool LocationIsOnSystemFramework(const char* full_path) { std::string error_msg; std::string root_path = GetAndroidRootSafe(&error_msg); if (root_path.empty()) { @@ -275,12 +275,7 @@ bool LocationIsOnSystemFramework(const char* location) { return false; } std::string framework_path = root_path + "/framework/"; - - // Warning: Bionic implementation of realpath() allocates > 12KB on the stack. - // Do not run this code on a small stack, e.g. in signal handler. - UniqueCPtr<const char[]> path(realpath(location, nullptr)); - return path != nullptr && - android::base::StartsWith(path.get(), framework_path.c_str()); + return android::base::StartsWith(full_path, framework_path); } } // namespace art |