This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch] Fix libstdc++/9507


Hi,

among the ton of PR filed by Pétur ;), this one appears pretty
easy to analyze and fix.

Ok for trunk and 3.3?

Paolo.

P.S. The original testcase is really involved compared to the
underlying issue and I would rather prefer not adding it.

///////////
2003-02-01  Paolo Carlini  <pcarlini@unitus.it>

	PR libstdc++/9507
	* include/bits/fstream.tcc (open): If the 'ate' repositioning
	operation fails, calls close _and_ returns a null pointer
	to indicate failure (27.8.1.3,4).
diff -urN libstdc++-v3-orig/include/bits/fstream.tcc libstdc++-v3/include/bits/fstream.tcc
--- libstdc++-v3-orig/include/bits/fstream.tcc	2003-01-23 23:53:35.000000000 +0100
+++ libstdc++-v3/include/bits/fstream.tcc	2003-02-02 00:44:42.000000000 +0100
@@ -103,7 +103,11 @@
 	      
 	      if ((__mode & ios_base::ate)
 		  && this->seekoff(0, ios_base::end, __mode) < 0)
-		this->close();
+		{
+		  // 27.8.1.3,4
+		  this->close();
+		  return __ret;
+		}
 
 	      __ret = this;
 	    }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]