]> granicus.if.org Git - php/commitdiff
MFB
authorNuno Lopes <nlopess@php.net>
Tue, 2 Jan 2007 15:31:58 +0000 (15:31 +0000)
committerNuno Lopes <nlopess@php.net>
Tue, 2 Jan 2007 15:31:58 +0000 (15:31 +0000)
ext/standard/proc_open.c

index fd824418874a493077fa6b0b2c3373e038253e18..5d068a4413f84e814bd09b1ba8a5e0189491a70a 100644 (file)
@@ -602,8 +602,6 @@ PHP_FUNCTION(proc_open)
                                }
 #endif
 
-                               
-
                        } else if (strcmp(Z_STRVAL_PP(ztype), "file") == 0) {
                                zval **zfile, **zmode;
                                char *filename;
@@ -781,7 +779,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;
@@ -850,7 +849,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));