wez             Wed Mar 19 14:27:53 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php4/main  streams.c 
  Log:
  This little fragment didn't get merged from head...
  
  
Index: php4/main/streams.c
diff -u php4/main/streams.c:1.125.2.46 php4/main/streams.c:1.125.2.47
--- php4/main/streams.c:1.125.2.46      Tue Mar 18 20:34:38 2003
+++ php4/main/streams.c Wed Mar 19 14:27:52 2003
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: streams.c,v 1.125.2.46 2003/03/19 01:34:38 wez Exp $ */
+/* $Id: streams.c,v 1.125.2.47 2003/03/19 19:27:52 wez Exp $ */
 
 #define _GNU_SOURCE
 #include "php.h"
@@ -1458,6 +1458,11 @@
                        } else {
                                ret = fclose(data->file);
                        }
+                       data->file = NULL;
+                       data->fd = -1;
+               } else if (data->fd != -1) {
+                       ret = close(data->fd);
+                       data->fd = -1;
                } else {
                        return 0;/* everything should be closed already -> success*/
                }
@@ -1470,7 +1475,6 @@
                ret = 0;
                data->file = NULL;
        }
-
        pefree(data, stream->is_persistent);
 
        return ret;
@@ -1550,7 +1554,9 @@
                                return FAILURE;
                        }
                        if (ret) {
-                               fflush(data->file);
+                               if (data->file) {
+                                       fflush(data->file);
+                               }
                                *(int*)ret = fd;
                        }
                        return SUCCESS;



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

Reply via email to