File libzip-ocloexec.patch of Package libzip

diff -r 7ce71a0ca2b3 lib/zip_close.c
--- a/lib/zip_close.c	Thu Dec 19 12:41:37 2013 +0100
+++ b/lib/zip_close.c	Thu Apr 03 18:06:00 2014 +0200
@@ -47,9 +47,9 @@
 #endif
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <fcntl.h>
 #ifdef _WIN32
 #include <io.h>
-#include <fcntl.h>
 #endif
 
 
@@ -269,7 +269,7 @@
 	free(temp);
 	if (reopen_on_error) {
 	    /* ignore errors, since we're already in an error case */
-	    za->zp = fopen(za->zn, "rb");
+	    za->zp = fopen(za->zn, "rbe");
 	}
 	return -1;
     }
@@ -610,7 +610,7 @@
         sprintf(temp, "%s.XXXXXX", za->zn);
     }
 
-    if ((tfd=mkstemp(temp)) == -1) {
+    if ((tfd=mkostemp(temp, O_CLOEXEC)) == -1) {
 	_zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);
 	free(temp);
 	return NULL;
diff -r 7ce71a0ca2b3 lib/zip_open.c
--- a/lib/zip_open.c	Thu Dec 19 12:41:37 2013 +0100
+++ b/lib/zip_open.c	Thu Apr 03 18:06:00 2014 +0200
@@ -92,7 +92,7 @@
 	break;
     }
 
-    if ((fp=fopen(fn, "rb")) == NULL) {
+    if ((fp=fopen(fn, "rbe")) == NULL) {
 	set_error(zep, NULL, ZIP_ER_OPEN);
 	return NULL;
     }
diff -r 7ce71a0ca2b3 lib/zip_source_filep.c
--- a/lib/zip_source_filep.c	Thu Dec 19 12:41:37 2013 +0100
+++ b/lib/zip_source_filep.c	Thu Apr 03 18:06:00 2014 +0200
@@ -134,7 +134,7 @@
     switch (cmd) {
     case ZIP_SOURCE_OPEN:
 	if (z->fname) {
-	    if ((z->f=fopen(z->fname, "rb")) == NULL) {
+	    if ((z->f=fopen(z->fname, "rbe")) == NULL) {
 		z->e[0] = ZIP_ER_OPEN;
 		z->e[1] = errno;
 		return -1;
openSUSE Build Service is sponsored by