Source: libc6
Version: 2.17-97
Severity: normal

Dear Maintainer,

The libc6 manpage on fopencookie() says, with regards to the writer
function in the cookie_io_functions_t, that "As its function result,
the write function should return the number of bytes copied from
buf, or 0 on error." Similarly, the Texinfo manual says that "Your
function should transfer up to SIZE bytes from the buffer, and return
the number of bytes written."

This seems to imply that the writer function is supposed to work
similar to write(2) and may choose to consume less data than is
passed to it, and return how much data it did in fact consume.
However, when I actually do this, libc seems to consider that an
error and the stream stops working. As soon as I change my writer
function so that it does consume all the data in the buffer, my
program starts working as expected.

I can't say I know if it's the code or the documentation which is
wrong, but at least one of them seems to be in error.

--
Fredrik Tolf

-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing'), (99, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.12-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to