Failure of test07 in 27_io/filebuf_members.cc under HP-UX (PR 9964)

John David Anglin dave@hiauly1.hia.nrc.ca
Thu Apr 10 19:52:00 GMT 2003


> I have examined the failure of 27_io/filebuf_members.cc on
> hppa2.0w-hp-hpux11.11.  The test fails because the following code
> from config/io/basic_file_stdio.cc doesn't close the file after a
> character is written to a broken pipe:

The enclosed patch against the 3.3 branch fixes the failure of
27_io/filebuf_members.cc on hppa2.0w-hp-hpux11.11.

Ok for 3.3 and main?

Dave
-- 
J. David Anglin                                  dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

2003-04-10  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>

	* basic_file_stdio.cc (__basic_file<char>::close): Don't flush stream
	twice.  Always set _M_cfile to 0 when stream was open.

Index: config/io/basic_file_stdio.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/config/io/basic_file_stdio.cc,v
retrieving revision 1.6.2.2
diff -u -3 -p -r1.6.2.2 basic_file_stdio.cc
--- config/io/basic_file_stdio.cc	5 Feb 2003 19:20:07 -0000	1.6.2.2
+++ config/io/basic_file_stdio.cc	10 Apr 2003 19:39:25 -0000
@@ -181,12 +181,12 @@ namespace std 
     __basic_file* __retval = static_cast<__basic_file*>(NULL);
     if (this->is_open())
       {
-	fflush(_M_cfile);
-	if ((_M_cfile_created && fclose(_M_cfile) == 0) || !_M_cfile_created)
-	  {
-	    _M_cfile = 0;
-	    __retval = this;
-	  }
+	if (_M_cfile_created)
+	  fclose(_M_cfile);
+	else
+	  fflush(_M_cfile);
+	_M_cfile = 0;
+	__retval = this;
       }
     return __retval;
   }



More information about the Gcc-patches mailing list