Linux-man Archive on lore.kernel.org
 help / color / Atom feed
* Re: [patch] ptsname.3: Fix description of failure behaviour of ptsname_r
       [not found] <9623994.qWbdUN1Qb5@omega>
@ 2020-04-25 19:24 ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; only message in thread
From: Michael Kerrisk (man-pages) @ 2020-04-25 19:24 UTC (permalink / raw)
  To: Bruno Haible, linux-man, Eric Blake; +Cc: mtk.manpages, Rich Felker

On 1/26/19 2:31 PM, Bruno Haible wrote:
> Hi,
> 
> The Linux man page for ptsname_r, when describing the behaviour in the error
> case, is
>   - not consistent with the future POSIX standard (POSIX Issue 8).
>   - not consistent with musl libc.
> 
> Find attached a patch to
>   - keep it consistent with what glibc does,
>   - make it consistent with musl libc,
>   - make it consistent with the future POSIX standard (POSIX Issue 8).
> 
> Details:
> 
> glibc's implementation of ptsname_r, when it fails, returns the error code
> as return value AND sets errno. See
> https://sourceware.org/git/?p=glibc.git;a=blob;f=login/ptsname.c
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mach/hurd/ptsname.c
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ptsname.c
> 
> musl's implementation of ptsname_r, when it fails, returns the error code
> but does NOT set errno. See
> https://git.musl-libc.org/cgit/musl/tree/src/misc/pty.c
> 
> The proposal to add ptsname_r to POSIX, with text
>   "If successful, the ptsname_r( ) function shall return zero. Otherwise,
>    an error number shall be returned to indicate the error."
> has been accepted for inclusion in POSIX Issue 8.
> http://austingroupbugs.net/view.php?id=508
> 
> Therefore a portable program should look at the return value from ptsname_r,
> NOT the errno value. The current text in the man page suggests to look at
> the errno value, which is wrong (because of musl libc) and not future-proof
> (because of future POSIX).

Thanks, Bruno. Patch (finally) applied.

Cheers,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <9623994.qWbdUN1Qb5@omega>
2020-04-25 19:24 ` [patch] ptsname.3: Fix description of failure behaviour of ptsname_r Michael Kerrisk (man-pages)

Linux-man Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-man/0 linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ https://lore.kernel.org/linux-man \
		linux-man@vger.kernel.org
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-man


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git