diff options
author | 2018-04-11 15:44:19 -0700 | |
---|---|---|
committer | 2018-04-12 03:00:16 +0000 | |
commit | db20a4b08389e73d4f74308644100e5e202fe2bc (patch) | |
tree | 6e30013c1c565ffca13b5055b4de1167a177d9a4 /compiler/driver/compiler_driver.h | |
parent | 49720a09e33bce331f7231671c0795864bbac0b3 (diff) |
ART: Fix core image detection
Accept any .art name starting with "core-." Correctly detects
images with multiple dashes.
Bug: 64382372
Test: mmma art
Test: art/test/testrunner/testrunner.py -b --host
Test: Device boots
Change-Id: I6c8006411b0ec16225b137dd349d53d9bc0ac03d
Diffstat (limited to 'compiler/driver/compiler_driver.h')
-rw-r--r-- | compiler/driver/compiler_driver.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index 682cf16d45..a5462eefe2 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -378,11 +378,11 @@ class CompilerDriver { if (!android::base::EndsWith(boot_image_filename, ".art")) { return false; } - size_t dash_pos = boot_image_filename.find_last_of("-/"); - if (dash_pos == std::string::npos || boot_image_filename[dash_pos] != '-') { - return false; + size_t slash_pos = boot_image_filename.rfind('/'); + if (slash_pos == std::string::npos) { + return android::base::StartsWith(boot_image_filename, "core-"); } - return (dash_pos >= 4u) && (boot_image_filename.compare(dash_pos - 4u, 4u, "core") == 0); + return boot_image_filename.compare(slash_pos + 1, 5u, "core-") == 0; } optimizer::DexToDexCompiler& GetDexToDexCompiler() { |