]> granicus.if.org Git - php/commitdiff
+- Fixed bug #37619 (proc_open() closes stdin on fork() failure).
authorNuno Lopes <nlopess@php.net>
Tue, 2 Jan 2007 15:29:09 +0000 (15:29 +0000)
committerNuno Lopes <nlopess@php.net>
Tue, 2 Jan 2007 15:29:09 +0000 (15:29 +0000)
NEWS
ext/standard/proc_open.c

diff --git a/NEWS b/NEWS
index 7730388eb5e1bec4dd4e08850f0e49ddfb927ca9..f2e03da5a15809b8f79d1c97576de6d655c863d0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -51,6 +51,8 @@ PHP                                                                        NEWS
 - Fixed bugs #39361 & #39400 (mbstring function overloading problem). (Seiji)
 - Fixed bug #38852 (XML-RPC Breaks iconv). (Hannes)
 - Fixed bug #38542 (proc_get_status() returns wrong PID on windows). (Nuno)
+- Fixed bug #37619 (proc_open() closes stdin on fork() failure).
+  (jdolecek at NetBSD dot org, Nuno)
 - Fixed bug #37588 (COM Property propputref converts to PHP function
   and can't be accesed). (Rob)
 - Fixed bug #36427 (proc_open() / proc_close() leak handles on windows).
index 773637a05f23b47058b0d89793c4814443fc5f13..e11ba1daf650384a63604773778907d9289fb45f 100644 (file)
@@ -625,8 +625,6 @@ PHP_FUNCTION(proc_open)
                                        descriptors[ndesc].mode_flags |= O_BINARY;
 #endif
 
-                               
-
                        } else if (strcmp(Z_STRVAL_PP(ztype), "file") == 0) {
                                zval **zfile, **zmode;
                                int fd;
@@ -788,7 +786,8 @@ PHP_FUNCTION(proc_open)
                /* clean up all the descriptors */
                for (i = 0; i < ndesc; i++) {
                        close(descriptors[i].childend);
-                       close(descriptors[i].parentend);
+                       if (descriptors[i].parentend)
+                               close(descriptors[i].parentend);
                }
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "procve failed - %s", strerror(errno));
                goto exit_fail;
@@ -855,7 +854,8 @@ PHP_FUNCTION(proc_open)
                /* clean up all the descriptors */
                for (i = 0; i < ndesc; i++) {
                        close(descriptors[i].childend);
-                       close(descriptors[i].parentend);
+                       if (descriptors[i].parentend)
+                               close(descriptors[i].parentend);
                }
 
                php_error_docref(NULL TSRMLS_CC, E_WARNING, "fork failed - %s", strerror(errno));