test file for non-portable IO extension(s)

brent verner brent@rcfile.org
Fri Jun 23 22:22:00 GMT 2000


On 23 Jun 2000 at 17:59 (-0700), Benjamin Kosnik said:
| 
| beginning bits of this are in as 27_io/filebuf_members.cc
| 
| this problem, as reported, is now fixed.

unfortunately, simply flagging this filebuf as 'special'breaks stuff :(
try this on for size...

#include <fstream>
#include <iostream>
#include <cassert>
#include <unistd.h>
#include <fcntl.h>

const char name01[] = "/dev/null";

void
test_01()
{
  int fd = open(name01, O_RDONLY);
  {
    std::filebuf fb(fd, "double_read", std::ios_base::in);
  }
  int close_num = close(fd);
  std::cout << close_num << std::endl;
  return;
}


int
main()
{
  test_01();
  return 0;
}


hmm... Segmentation Fault... just as I had hit upon when _trying_
to fix this :(  I'm no guru, but it looks like this is a situation
we are gonna have to live with, otherwise, I think we'll have to
dig into libio... where I'm not sure, but I suspect it has something
to do with _IO_unlink... whatever it _is_, the put to std::cout
causes the segfault -- but only if the ~filebuf() is called...
I spent a few days digging around this, and no straightforward
solution appeared to me. :(

-- 
Damon Brent Verner
Cracker Jack® Certified Professional
brent@rcfile.org, brent@linux1.org


More information about the Libstdc++ mailing list