basic_file_stdio.cc (__basic_file<char>::close): Don't flush stream twice.

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

From-SVN: r65458
This commit is contained in:
John David Anglin 2003-04-11 02:57:44 +00:00 committed by John David Anglin
parent 6d9c4c8386
commit e6670c79c7
2 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,8 @@
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.
2003-04-09 Benjamin Kosnik <bkoz@redhat.com> 2003-04-09 Benjamin Kosnik <bkoz@redhat.com>
Reshuffle 27_io testsuite. * testsuite/27_io/filebuf.cc, Reshuffle 27_io testsuite. * testsuite/27_io/filebuf.cc,

View File

@ -195,12 +195,12 @@ namespace std
__basic_file* __retval = static_cast<__basic_file*>(NULL); __basic_file* __retval = static_cast<__basic_file*>(NULL);
if (this->is_open()) if (this->is_open())
{ {
fflush(_M_cfile); if (_M_cfile_created)
if ((_M_cfile_created && fclose(_M_cfile) == 0) || !_M_cfile_created) fclose(_M_cfile);
{ else
_M_cfile = 0; fflush(_M_cfile);
__retval = this; _M_cfile = 0;
} __retval = this;
} }
return __retval; return __retval;
} }