open_memstream: update docs wrt posix issue 8

Florian Weimer fweimer@redhat.com
Fri Sep 19 09:18:47 GMT 2025


* DJ Delorie:

> diff --git a/manual/stdio.texi b/manual/stdio.texi
> index 16d459424e..3ae906cdee 100644
> --- a/manual/stdio.texi
> +++ b/manual/stdio.texi
> @@ -5141,7 +5141,12 @@ is @emph{not} included in the size value stored at @var{sizeloc}.
>  You can move the stream's file position with @code{fseek} or
>  @code{fseeko} (@pxref{File Positioning}).  Moving the file position past
>  the end of the data already written fills the intervening space with
> -zeroes.
> +zeroes.  Note that seeking backwards into existing written data will
> +change the effective ``end of file'' used by @code{fflush} and
> +@code{SEEK_END}.  Thus, if you wish to do ``random-access'' I/O in a
> +memstream, it's important to use @code{fseek} to move the file
> +position to the desired data end (using @code{SEEK_POS}) before
> +flushing or closing it.
>  @end deftypefun

Is the unexpected outcome additional null bytes in the buffer?  If
that's the case, maybe mention it?

Thanks,
Florian



More information about the Libc-alpha mailing list