This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/17215] New: __basic_file<char>::close ignores errors
- From: "ken at xorian dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2004 18:04:13 -0000
- Subject: [Bug libstdc++/17215] New: __basic_file<char>::close ignores errors
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
__basic_file<char>::close ignores the return value of fclose(3). This
call can fail and set errno to a variety of values (ENOSPC, EINTR,
etc.). Aside from not notifying the client code (e.g. by setting
failbit in an enclosing fstream), this can also cause a memory leak as
the FILE data structure won't be de-allocated by a failed fclose and
__basic_file<char>::close discards it regardless.
Similarly, in the case where _M_cfile_created is false,
__basic_file<char>::close ignores the return value of this->sync(),
which is just a call to fflush(3). This is not quite as bad (as it
can't cause a memory leak), but is still arguably wrong.
--
Summary: __basic_file<char>::close ignores errors
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ken at xorian dot net
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17215