public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/65411] New: Unsafe(?) repeated call to fclose() in config/io/basic_file_stdio.cc
@ 2015-03-12 20:00 redi at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: redi at gcc dot gnu.org @ 2015-03-12 20:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65411

            Bug ID: 65411
           Summary: Unsafe(?) repeated call to fclose() in
                    config/io/basic_file_stdio.cc
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

http://pubs.opengroup.org/onlinepubs/9699919799/functions/fclose.html says:

  Whether or not the call succeeds, the stream shall be disassociated from
  the file [...] The fclose() function shall perform the equivalent of a
  close() on the file descriptor that is associated with the stream pointed
  to by stream. [...] After the call to fclose(), any use of stream results
  in undefined behavior.

We do this in __basic_file<char>::close()

        errno = 0;
        do
          __err = fclose(_M_cfile);
        while (__err && errno == EINTR);

We should check whether that's correct.

http://austingroupbugs.net/view.php?id=529 tells me that close() on linux (and
everywhere except HPUX) always closes the fd even if interrupted.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-12 20:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-12 20:00 [Bug libstdc++/65411] New: Unsafe(?) repeated call to fclose() in config/io/basic_file_stdio.cc redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).