From: Dmitriy Ivanov Date: Thu, 16 Jul 2015 11:52:06 +0000 (-0700) Subject: Add constant for zip separator X-Git-Tag: android-x86-7.1-r1~270^2~230^2~64^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=730ed9dfec37441ae0cbb96f681381da6e113daa;p=android-x86%2Fbionic.git Add constant for zip separator Change-Id: I1dcbb15ac612fc28e922eb3de8148fcaebbc0820 --- diff --git a/linker/linker.cpp b/linker/linker.cpp index 97e390bca..73eeba17b 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -102,6 +102,7 @@ static const char* const kAsanDefaultLdPaths[] = { static const ElfW(Versym) kVersymNotNeeded = 0; static const ElfW(Versym) kVersymGlobal = 1; +static const char* const kZipFileSeparator = "!/"; static const char* const* g_default_ld_paths; static std::vector g_ld_library_paths; @@ -1142,7 +1143,7 @@ static int open_library_in_zipfile(const char* const path, // of the zip file on disk and the subdirectory to search within it. // For example, if path is "foo.zip!/bar/bas/x.so", then we search for // "bar/bas/x.so" within "foo.zip". - const char* separator = strstr(path, "!/"); + const char* separator = strstr(path, kZipFileSeparator); if (separator == nullptr) { return -1; } @@ -1228,7 +1229,7 @@ static int open_library_on_paths(const char* name, off64_t* file_offset, } int fd = -1; - if (strchr(buf, '!') != nullptr) { + if (strstr(buf, kZipFileSeparator) != nullptr) { fd = open_library_in_zipfile(buf, file_offset); } @@ -1252,7 +1253,7 @@ static int open_library(const char* name, soinfo *needed_by, off64_t* file_offse // If the name contains a slash, we should attempt to open it directly and not search the paths. if (strchr(name, '/') != nullptr) { - if (strchr(name, '!') != nullptr) { + if (strstr(name, kZipFileSeparator) != nullptr) { int fd = open_library_in_zipfile(name, file_offset); if (fd != -1) { return fd;