summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNuno Lopes <nlopess@php.net>2007-01-02 15:29:09 +0000
committerNuno Lopes <nlopess@php.net>2007-01-02 15:29:09 +0000
commit8a806d186e048d8e7b632e09b30db4b32a4c4fe1 (patch)
treed7bffdcff159196672ba8d5f21cc46df8ab94b17 /ext
parentf3d0a26e13d38fbea0ca2aecc7475168395a4f21 (diff)
downloadphp-git-8a806d186e048d8e7b632e09b30db4b32a4c4fe1.tar.gz
+- Fixed bug #37619 (proc_open() closes stdin on fork() failure).
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/proc_open.c8
1 files changed, 4 insertions, 4 deletions
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));