File php5-cloexec.patch of Package php5.openSUSE_Leap_42.1_Update

Index: ext/standard/exec.c
===================================================================
--- ext/standard/exec.c.orig
+++ ext/standard/exec.c
@@ -76,7 +76,11 @@ PHPAPI int php_exec(int type, char *cmd,
 #ifdef PHP_WIN32
 	fp = VCWD_POPEN(cmd, "rb");
 #else
+  #if defined(__linux__) &&  __GLIBC_PREREQ(2, 9)
+        fp = VCWD_POPEN(cmd, "re");
+  #else
 	fp = VCWD_POPEN(cmd, "r");
+  #endif
 #endif
 	if (!fp) {
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to fork [%s]", cmd);
Index: ext/standard/file.c
===================================================================
--- ext/standard/file.c.orig
+++ ext/standard/file.c
@@ -927,6 +927,12 @@ PHP_FUNCTION(popen)
 		}
 	}
 #endif
+#if defined(__linux__) &&  __GLIBC_PREREQ(2, 9)
+        char *e = memchr(posix_mode, 'e', mode_len);
+         if (e) {
+                memmove(e, e + 1, mode_len - (e - posix_mode));
+        }
+#endif
 
 	fp = VCWD_POPEN(command, posix_mode);
 	if (!fp) {
Index: ext/standard/mail.c
===================================================================
--- ext/standard/mail.c.orig
+++ ext/standard/mail.c
@@ -331,8 +331,12 @@ PHPAPI int php_mail(char *to, char *subj
 	 * (e.g. the shell can't be executed) we explicitly set it to 0 to be
 	 * sure we don't catch any older errno value. */
 	errno = 0;
+#if defined(__linux__) &&  __GLIBC_PREREQ(2, 9)
+	sendmail = popen(sendmail_cmd, "we");
+#else 
 	sendmail = popen(sendmail_cmd, "w");
 #endif
+#endif
 	if (extra_cmd != NULL) {
 		efree (sendmail_cmd);
 	}
openSUSE Build Service is sponsored by