[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#345821: libstdc++6: Documentation bug in ext/stdio_filebuf.h



Package: libstdc++6
Version: 4.0.2-5
Severity: normal

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:

-- System Information:
--- 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,

I also filed this upstream
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25653).


Regards,
Roger


Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages libstdc++6 depends on:
ii  gcc-4.0-base                  4.0.2-5    The GNU Compiler Collection (base 
ii  libc6                         2.3.5-10   GNU C Library: Shared libraries an
ii  libgcc1                       1:4.0.2-5  GCC support library

libstdc++6 recommends no packages.

-- no debconf information



Reply to: