Since glibc 2.7, it is possible to seek past the end of

a stream created by open_memstream().  Add a BUGS section
describing the bug in earlier glibc versions.
This commit is contained in:
Michael Kerrisk 2008-08-21 10:06:18 +00:00
parent a126897a7a
commit 33b1b47eb7
1 changed files with 16 additions and 11 deletions

View File

@ -2,7 +2,7 @@
.\" and Copyright 2005 Michael Kerrisk <mtk.manpages@gmail.com>
.\" Distributed under the GPL.
.\"
.TH FMEMOPEN 3 2005-12-08 "GNU" "Linux Programmer's Manual"
.TH FMEMOPEN 3 2008-08-21 "GNU" "Linux Programmer's Manual"
.SH NAME
fmemopen, open_memstream \- open memory as stream
.SH SYNOPSIS
@ -120,16 +120,14 @@ This byte is
.I not
included in the size value stored at
.IR sizeloc .
.\"
.\" FIXME . The glibc info doc has text like the following, but it appears
.\" not to be true: http://sourceware.org/bugzilla/show_bug.cgi?id=1996
.\" The stream's file position can be changed with
.\" .BR fseek (3)
.\" or
.\" .BR fseeko (3).
.\" Moving the file position past the end
.\" of the data already written fills the intervening space with
.\" zeros.
The stream's file position can be changed with
.BR fseek (3)
or
.BR fseeko (3).
Moving the file position past the end
of the data already written fills the intervening space with
zeros.
.SH "RETURN VALUE"
Upon successful completion
.BR fmemopen ()
@ -203,6 +201,13 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
.fi
.SH BUGS
In glibc before version 2.7, seeking past the end of a stream created by
.BR open_memstream ()
does not enlarge the buffer; instead the
.BR fseek ()
call fails, returning \-1.
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=1996
.SH "SEE ALSO"
.BR fopen (3),
.BR feature_test_macros (7)