public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/65411] New: Unsafe(?) repeated call to fclose() in config/io/basic_file_stdio.cc Date: Thu, 12 Mar 2015 20:00:00 -0000 [thread overview] Message-ID: <bug-65411-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
reply other threads:[~2015-03-12 20:00 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-65411-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).