Note in fmemopen() that no file descriptor is allocated
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 9c3275a90904160726i68a4c1f6u8173f72365042e65-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
PATCH 1/1 Note in fmemopen() that no file descriptor is allocated
Alexander Lamaison <[email protected]> pointed out that this is not obvious from the documentation, citing an example with passing
the FILE * handle to a function that tries to fstat() its fileno()
in order to determine the buffer size.
This also moves BUGS before EXAMPLE according to the recommended section order.
man3/fmemopen.3 +16 -7
@@ -173,6 +173,22 @@ POSIX.1-2008. These functions are not specified in POSIX.1-2001, and are not widely available on other systems. These functions are GNU extensions. +.SH NOTES +There is no valid file descriptor associated with +the returned handle, therefore +.BR fileno (3) +will return a negative value. +Thus, you e.g. cannot determine the buffer size using +.I fstat(fileno(f), &stat) +and looking at +.IR stat.st_size . +.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 "EXAMPLE" The program below uses .BR fmemopen ()
@@ -236,13 +252,6 @@ 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 fopencookie (3),
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Petr
Quoted 7 lines · Petr Baudis
Alexander Lamaison <[email protected]> pointed out that this is not obvious from the documentation, citing an example with passing
the FILE * handle to a function that tries tofstat()itsfileno()
in order to determine the buffer size.This also moves BUGS before EXAMPLE according to the recommended section order.
Thanks -- I applied that as a separate change.
Quoted 11 lines
Signed-off-by Petr Baudis <[email protected]>man3/fmemopen.3 +0
-0@@ -173,6 +173,22 @@ POSIX.1-2008. These functions are not specified in POSIX.1-2001,and are not widely available on other systems.
These functions are GNU extensions.
+.SH NOTES
man3/fmemopen.3 POSIX.1-2008. · line 184
Quoted 8 lines
man3/fmemopen.3 +8
-0+There is no valid file descriptor associated with +the returned handle, therefore +.BR fileno (3) +will return a negative value. +Thus, you e.g. cannot determine the buffer size using +.I fstat(fileno(f), &stat) +and looking at +.IR stat.st_size .
I shortened and reworded your text somewhat, since I don't think we need to mention details about fstat():
[[
.SH NOTES
There is no file descriptor associated with the file stream returned by these functions
(i.e.,
.BR fileno (3)
will return an error if called on the returned stream). ]]
The changes will be in man-pages-3.22.
Thanks,
Michael
Signature · 9 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html