zip_archive.cc: add O_CLOEXEC

Prevent file descriptors from leaking across an exec() boundary.

Bug: 120983106
Test: compiles and boots
Change-Id: I392b0767674b557b1e4404a2ba63bc48e3e37b24
This commit is contained in:
Nick Kralevich 2018-12-18 12:48:06 -08:00
parent 8fd4435d53
commit 3bdf744a55

View file

@ -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;