wez             Sat Nov 16 20:06:32 2002 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/main  streams.c 
  Log:
  Avoid a potential double fclose().
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.125.2.9 php4/main/streams.c:1.125.2.10
--- php4/main/streams.c:1.125.2.9       Sat Nov 16 19:11:19 2002
+++ php4/main/streams.c Sat Nov 16 20:06:31 2002
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.9 2002/11/17 00:11:19 iliaa Exp $ */
+/* $Id: streams.c,v 1.125.2.10 2002/11/17 01:06:31 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1336,10 +1336,12 @@
        assert(data != NULL);
 
        if (close_handle) {
-               if (data->is_process_pipe) {
-                       ret = pclose(data->file);
-               } else {
-                       ret = fclose(data->file);
+               if (data->file) {
+                       if (data->is_process_pipe) {
+                               ret = pclose(data->file);
+                       } else {
+                               ret = fclose(data->file);
+                       }
                }
                if (data->temp_file_name) {
                        unlink(data->temp_file_name);
@@ -1347,6 +1349,7 @@
                }
        } else {
                ret = 0;
+               data->file = NULL;
        }
 
        /* STDIO streams are never persistent! */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to