diff options
| -rw-r--r-- | libdexfile/dex/art_dex_file_loader.cc | 2 | ||||
| -rw-r--r-- | libprofile/profile/profile_compilation_info.cc | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/libdexfile/dex/art_dex_file_loader.cc b/libdexfile/dex/art_dex_file_loader.cc index eb7d3d3308..4f73967353 100644 --- a/libdexfile/dex/art_dex_file_loader.cc +++ b/libdexfile/dex/art_dex_file_loader.cc @@ -95,7 +95,7 @@ bool ArtDexFileLoader::GetMultiDexChecksums(const char* filename, File fd; if (zip_fd != -1) { if (ReadMagicAndReset(zip_fd, &magic, error_msg)) { - fd = File(zip_fd, false /* check_usage */); + fd = File(DupCloexec(zip_fd), false /* check_usage */); } } else { fd = OpenAndReadMagic(filename, &magic, error_msg); diff --git a/libprofile/profile/profile_compilation_info.cc b/libprofile/profile/profile_compilation_info.cc index c7653457aa..9b70e62f0c 100644 --- a/libprofile/profile/profile_compilation_info.cc +++ b/libprofile/profile/profile_compilation_info.cc @@ -34,6 +34,7 @@ #include "base/arena_allocator.h" #include "base/dumpable.h" +#include "base/file_utils.h" #include "base/logging.h" // For VLOG. #include "base/malloc_arena_pool.h" #include "base/os.h" @@ -1171,7 +1172,8 @@ ProfileCompilationInfo::ProfileLoadStatus ProfileCompilationInfo::OpenSource( source->reset(ProfileSource::Create(fd)); return kProfileLoadSuccess; } else { - std::unique_ptr<ZipArchive> zip_archive(ZipArchive::OpenFromFd(fd, "profile", error)); + std::unique_ptr<ZipArchive> zip_archive( + ZipArchive::OpenFromFd(DupCloexec(fd), "profile", error)); if (zip_archive.get() == nullptr) { *error = "Could not open the profile zip archive"; return kProfileLoadBadData; |