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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, when the filebuf is given a FILE* it doesn't own it, and so the destructor
doesn't touch it:

  __basic_file<char>*
  __basic_file<char>::close()
  {
    __basic_file* __ret = static_cast<__basic_file*>(NULL);
    if (this->is_open())
      {
        int __err = 0;
        if (_M_cfile_created)
          __err = fclose(_M_cfile);
        _M_cfile = 0;
        if (!__err)
          __ret = this;
      }
    return __ret;
  }

_M_cfile_created is only true when it's opened using a filename (because it
calls fopen) or a file descriptor (because it calls fdopen).

Reply via email to