thies           Wed Jan 10 05:08:14 2001 EDT

  Modified files:              
    /php4/ext/standard  exec.c 
  Log:
  exec'd processes now get cleaned up even if the browser connections was 
  aborted. 
  fixes: #8143
  
  
Index: php4/ext/standard/exec.c
diff -u php4/ext/standard/exec.c:1.44 php4/ext/standard/exec.c:1.45
--- php4/ext/standard/exec.c:1.44       Mon Jan  8 08:39:39 2001
+++ php4/ext/standard/exec.c    Wed Jan 10 05:08:14 2001
@@ -15,7 +15,7 @@
    | Author: Rasmus Lerdorf                                               |
    +----------------------------------------------------------------------+
  */
-/* $Id: exec.c,v 1.44 2001/01/08 16:39:39 stas Exp $ */
+/* $Id: exec.c,v 1.45 2001/01/10 13:08:14 thies Exp $ */
 
 #include <stdio.h>
 #include "php.h"
@@ -23,6 +23,7 @@
 #include "php_string.h"
 #include "safe_mode.h"
 #include "ext/standard/head.h"
+#include "ext/standard/file.h"
 #include "exec.h"
 #include "php_globals.h"
 #include "SAPI.h"
@@ -45,6 +46,7 @@
        int buflen = 0;
        int t, l, ret, output=1;
        int overflow_limit, lcmd, ldir;
+       int rsrc_id;
        char *b, *c, *d=NULL;
        PLS_FETCH();
 
@@ -116,6 +118,13 @@
                        array_init(array);
                }
        }
+
+       /* we register the resource so that case of an aborted connection the 
+        * fd gets pclosed
+        */
+
+       rsrc_id = ZEND_REGISTER_RESOURCE(NULL, fp, php_file_le_fopen());
+
        if (type != 3) {
                l=0;
                while ( !feof(fp) || l != 0 ) {
@@ -183,8 +192,10 @@
                                if (output) (void)PUTC(buf[i]);
                }
        }
+
+       /* the zend_list_delete will pclose our popen'ed process */
+       zend_list_delete(rsrc_id); 
        
-       ret = pclose(fp);
 #if HAVE_SYS_WAIT_H
        if (WIFEXITED(ret)) {
                ret = WEXITSTATUS(ret);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to