From db20a4b08389e73d4f74308644100e5e202fe2bc Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Wed, 11 Apr 2018 15:44:19 -0700 Subject: 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 --- compiler/driver/compiler_driver.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/driver/compiler_driver.h') 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() { -- cgit v1.2.3-59-g8ed1b