This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
RE: [Patch] Fix libstdc++/9507
- From: Pétur Runólfsson <peturr02 at ru dot is>
- To: "Paolo Carlini" <pcarlini at unitus dot it>
- Cc: <libstdc++ at gcc dot gnu dot org>
- Date: Sun, 2 Feb 2003 13:15:40 -0000
- Subject: RE: [Patch] Fix libstdc++/9507
Hi
> >>P.S. The original testcase is really involved compared to the
> >>underlying issue and I would rather prefer not adding it.
> >>
> >It might be easier to test this by deriving a class from std::filebuf
> >and override seekoff to always return pos_type(off_type(-1)).
> >
> Yes, thanks, like this:
>
> class c_fbuf : public basic_filebuf<char>
> {
> pos_type
> seekoff(off_type __off, ios_base::seekdir __way, ios_base::openmode
> __mode)
> {
> return pos_type(off_type(-1));
> }
> };
>
> int main()
> {
> c_fbuf fbuf;
> c_fbuf* r = static_cast<c_fbuf*>(fbuf.open("xxx", ios_base::out |
> ios_base::ate));
> assert(!fbuf.is_open());
> assert(r == NULL);
> }
On second thought, this probably isn't correct, I don't think open
is required to call seekoff, it might for example call fseek directly.
> however, I didn't notice that all the necessary includes were already
> present in filebuf_members.cc and another testcase used the very same
> functions. I'm going to post a revised patch including your original
> testcase.
If you are changing filebuf_members.cc, you might want to remove the
exit(0); at the end of test04 - it seems that test05 is never run :-)
Regards,
Petur