]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
basic_file_stdio.cc (__basic_file<char>::close): Don't flush stream twice.
authorJohn David Anglin <dave.anglin@nrc-cnrc.gc.ca>
Fri, 11 Apr 2003 02:57:44 +0000 (02:57 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Fri, 11 Apr 2003 02:57:44 +0000 (02:57 +0000)
* 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

libstdc++-v3/ChangeLog
libstdc++-v3/config/io/basic_file_stdio.cc

index 1f1f3c433dc8eefe58b02aca027cf37a2faaf214..11b2af8872fad3444011707afc21bd0baeee9992 100644 (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>
 
        Reshuffle 27_io testsuite.  * testsuite/27_io/filebuf.cc,
index b2287b24f7f890e335b8a1809c781a97d5169f96..7f9c18bf05af60c67d4c794c426b38e4b8ced885 100644 (file)
@@ -195,12 +195,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;
   }