[PATCH] Note in fmemopen() that no file descriptor is allocated

Michael Kerrisk mtk.manpages@googlemail.com
Tue Apr 21 04:19:00 GMT 2009


Hi Petr

On Fri, Apr 17, 2009 at 2:58 AM, Petr Baudis <pasky@suse.cz> wrote:
> Alexander Lamaison <awl03@doc.ic.ac.uk> 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.

Thanks -- I applied that as a separate change.

> Signed-off-by: Petr Baudis <pasky@suse.cz>
>
> diff --git a/man3/fmemopen.3 b/man3/fmemopen.3
> index 608e16f..3ed6930 100644
> --- a/man3/fmemopen.3
> +++ b/man3/fmemopen.3
> @@ -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 .

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

-- 
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



More information about the Libc-help mailing list