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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Petr

On Fri, Apr 17, 2009 at 2:58 AM, Petr Baudis <pasky@xxxxxxx> wrote:
> Alexander Lamaison <awl03@xxxxxxxxxxxx> 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@xxxxxxx>
>
> 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
--
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

[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux