From 3bdf744a550b5c29c4f02a279d3376a9ebe1b053 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Tue, 18 Dec 2018 12:48:06 -0800 Subject: [PATCH] zip_archive.cc: add O_CLOEXEC Prevent file descriptors from leaking across an exec() boundary. Bug: 120983106 Test: compiles and boots Change-Id: I392b0767674b557b1e4404a2ba63bc48e3e37b24 --- libziparchive/zip_archive.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc index 9eb7f2cc9..6b9f6e165 100644 --- a/libziparchive/zip_archive.cc +++ b/libziparchive/zip_archive.cc @@ -491,7 +491,7 @@ int32_t OpenArchiveFd(int fd, const char* debug_file_name, ZipArchiveHandle* han } int32_t OpenArchive(const char* fileName, ZipArchiveHandle* handle) { - const int fd = ::android::base::utf8::open(fileName, O_RDONLY | O_BINARY, 0); + const int fd = ::android::base::utf8::open(fileName, O_RDONLY | O_BINARY | O_CLOEXEC, 0); ZipArchive* archive = new ZipArchive(fd, true); *handle = archive;