stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r671433 - /stdcxx/branches/4.2.x/include/fstream.cc
Date Wed, 25 Jun 2008 05:22:48 GMT
Author: faridz
Date: Tue Jun 24 22:22:47 2008
New Revision: 671433

URL: http://svn.apache.org/viewvc?rev=671433&view=rev
Log:
2008-06-25  Farid Zaripov  <faridz@apache.org>

	STDCXX-969
	* include/fstream.cc (close): Reset input/output sequences to prevent
	any subsequent I/O attempts on closed file.

Modified:
    stdcxx/branches/4.2.x/include/fstream.cc

Modified: stdcxx/branches/4.2.x/include/fstream.cc
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/fstream.cc?rev=671433&r1=671432&r2=671433&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/fstream.cc (original)
+++ stdcxx/branches/4.2.x/include/fstream.cc Tue Jun 24 22:22:47 2008
@@ -106,6 +106,10 @@
             _C_file    = 0;
             _C_cur_pos = _C_beg_pos = pos_type (off_type (-1));
 
+            // reset input/output sequences to prevent any
+            // subsequent I/O attempts on closed file
+            this->setg (0, 0, 0);
+            this->setp (0, 0);
         }
 
         // rethrow the caught exception
@@ -119,6 +123,11 @@
         // zero out the file pointer except when detaching fd
         _C_file    = 0;
         _C_cur_pos = _C_beg_pos = pos_type (off_type (-1));
+
+        // reset input/output sequences to prevent any
+        // subsequent I/O attempts on closed file
+        this->setg (0, 0, 0);
+        this->setp (0, 0);
     }
 
     return __retval;



Mime
View raw message