diff options
| author | Nuno Lopes <nlopess@php.net> | 2007-01-02 15:29:09 +0000 |
|---|---|---|
| committer | Nuno Lopes <nlopess@php.net> | 2007-01-02 15:29:09 +0000 |
| commit | 8a806d186e048d8e7b632e09b30db4b32a4c4fe1 (patch) | |
| tree | d7bffdcff159196672ba8d5f21cc46df8ab94b17 | |
| parent | f3d0a26e13d38fbea0ca2aecc7475168395a4f21 (diff) | |
| download | php-git-8a806d186e048d8e7b632e09b30db4b32a4c4fe1.tar.gz | |
+- Fixed bug #37619 (proc_open() closes stdin on fork() failure).
| -rw-r--r-- | NEWS | 2 | ||||
| -rw-r--r-- | ext/standard/proc_open.c | 8 |
2 files changed, 6 insertions, 4 deletions
@@ -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). diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 773637a05f..e11ba1daf6 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -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)); |
