File libzip-ocloexec.patch of Package libzip
--- a/lib/zip_source_filep.c 2016-12-31 13:39:23.000000000 +0100
+++ b/lib/zip_source_filep.c 2017-02-20 08:42:53.406688474 +0100
@@ -53,10 +53,7 @@
#define CAN_CLONE
#endif
-#ifdef _WIN32
-/* WIN32 needs <fcntl.h> for _O_BINARY */
#include <fcntl.h>
-#endif
/* Windows sys/types.h does not provide these */
#ifndef S_ISREG
@@ -254,7 +251,7 @@
sprintf(temp, "%s.XXXXXX", ctx->fname);
mask = umask(_SAFE_MASK);
- if ((tfd = mkstemp(temp)) == -1) {
+ if ((tfd = mkostemp(temp, O_CLOEXEC)) == -1) {
zip_error_set(&ctx->error, ZIP_ER_TMPOPEN, errno);
umask(mask);
free(temp);
@@ -449,7 +446,7 @@
case ZIP_SOURCE_OPEN:
if (ctx->fname) {
- if ((ctx->f = fopen(ctx->fname, "rb")) == NULL) {
+ if ((ctx->f = fopen(ctx->fname, "rbe")) == NULL) {
zip_error_set(&ctx->error, ZIP_ER_OPEN, errno);
return -1;
}