From 8a806d186e048d8e7b632e09b30db4b32a4c4fe1 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Tue, 2 Jan 2007 15:29:09 +0000 Subject: [PATCH] +- Fixed bug #37619 (proc_open() closes stdin on fork() failure). --- NEWS | 2 ++ ext/standard/proc_open.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 7730388eb5..f2e03da5a1 100644 --- 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). 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)); -- 2.50.1