Do not check zip-entry validity on create_namespace

This operation is the most expensive one and since it is
unlikely that the zip-entry name is invalid (given that it
is constructed by the platform) - it can removed.

The worst case scenario is dlopen() of non-existing libraries
taking more time. And this use-case is not on the critical path.

Bug: http://b/28801010
Change-Id: I10a6b0bf342404ab72f0f5102ebf19f6c06ee6bf
(cherry picked from commit a5c1c8e820)
This commit is contained in:
Dimitry Ivanov 2016-05-18 18:14:19 -07:00
parent 7d99bd38e4
commit d2205a641c
1 changed files with 0 additions and 36 deletions

View File

@ -405,42 +405,6 @@ static void resolve_paths(std::vector<std::string>& paths,
continue;
}
ZipArchiveHandle handle = nullptr;
void* cookie = nullptr;
auto zip_guard = make_scope_guard([&]() {
if (cookie != nullptr) {
EndIteration(cookie);
}
if (handle != nullptr) {
CloseArchive(handle);
}
});
if (OpenArchive(resolved_path, &handle) != 0) {
DL_WARN("Warning: unable to open zip archive: %s", resolved_path);
continue;
}
// Check if zip-file has a dir with entry_path name
std::string prefix_str = entry_path + "/";
ZipString prefix(prefix_str.c_str());
ZipEntry out_data;
ZipString out_name;
int32_t error_code;
if ((error_code = StartIteration(handle, &cookie, &prefix, nullptr)) != 0) {
DL_WARN("Unable to iterate over zip-archive entries \"%s\";"
" error code: %d", zip_path.c_str(), error_code);
continue;
}
if (Next(cookie, &out_data, &out_name) != 0) {
DL_WARN("Unable to find entries starting with \"%s\" in \"%s\"",
prefix_str.c_str(), zip_path.c_str());
continue;
}
resolved_paths->push_back(std::string(resolved_path) + kZipFileSeparator + entry_path);
}
}