Using libstdc++, I've got code like this: __gnu_cxx::stdio_filebuf<char> fdbuf(fd, std::ios::in);
The doxygen docs for this fd ctor say "The file descriptor will be automatically closed when the stdio_filebuf is closed/destroyed.", but I appear to be leaking fds due to making the assumption I was passing ownership of the fd to this streambuf, and not closing it by hand. Is this a documentation bug? I've checked <ext/stdio_filebuf.h>, and I can't see any referece to close(). The docs for the FILE* ctor say " The FILE* will **not** be automatically closed when the stdio_filebuf is closed/destroyed.", so it looks like the docs are wrong in this case. If this is true, just adding "not" should fix it: --- stdio_filebuf.h.old 2006-01-03 18:49:58.653951737 +0000 +++ stdio_filebuf.h 2006-01-03 18:50:31.536432330 +0000 @@ -72,7 +72,7 @@ * @param size Optimal or preferred size of internal buffer, in chars. * * This constructor associates a file stream buffer with an open - * POSIX file descriptor. The file descriptor will be automatically + * POSIX file descriptor. The file descriptor will not be automatically * closed when the stdio_filebuf is closed/destroyed. */ stdio_filebuf(int __fd, std::ios_base::openmode __mode, Regards, Roger -- Summary: Documentation bug in ext/stdio_filebuf.h Product: gcc Version: 4.0.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rleigh at debian dot org GCC build triplet: powerpc-linux-gnu GCC host triplet: powerpc-linux-gnu GCC target triplet: powerpc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25653