Hello Ralf, On 08/10/2016 10:05 PM, ralfg1@xxxxxxx wrote:
fmemopen(3), release 4.07 of the Linux /man-pages/ project The manpage suggests to use buf itself as IO-buffer: setbuffer(stream,buf,size);. It seems strange at least. In versions glibc 2.24 it also results in incorrect behavior, see http://stackoverflow.com/questions/38854163/using-rewind-on-a-file-opened-with-fmemopen. Thus I believe, the suggested code is invalid and I suggest to delete the corresponding sentence from the manpage. Should be cross-checked by some glibc developer. Best regards
Thanks for the patch. Rich Felker already reported this issue to me, and I've already made the same change to the page. Cheers, Michael
Ralfg1. ------------------------------------------------------------------------------------------------------------- diff --git a/man3/fmemopen.3 b/man3/fmemopen.3 index b17b6af..5836603 100644 --- a/man3/fmemopen.3 +++ b/man3/fmemopen.3 @@ -137,13 +137,6 @@ Disabling buffering with the following call may be useful to detect errors at the time of an output operation: setbuf(stream, NULL); - -Alternatively, the caller can explicitly set -.I buf -as the stdio stream buffer, at the same time informing stdio -of the buffer's size, using: - - setbuffer(stream, buf, size); .\" .\" See http://sourceware.org/bugzilla/show_bug.cgi?id=1995 .\" and
-- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html