Date: Wed, 12 Sep 2012 14:10:07 GMT From: Sergey Kandaurov <pluknet@gmail.com> To: freebsd-standards@FreeBSD.org Subject: Re: standards/171572: ptsname(-1) returns errno 0 Message-ID: <201209121410.q8CEA7Pw007687@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR standards/171572; it has been noted by GNATS. From: Sergey Kandaurov <pluknet@gmail.com> To: Ed Maste <emaste@freebsd.org> Cc: bug-followup@freebsd.org Subject: Re: standards/171572: ptsname(-1) returns errno 0 Date: Wed, 12 Sep 2012 18:07:16 +0400 On 12 September 2012 17:53, Ed Maste <emaste@freebsd.org> wrote: > On 12 September 2012 09:40, Sergey Kandaurov <pluknet@gmail.com> wrote: >> This is regression (or was it an intended change?) from 8.x's MPSAFE TTY: >> >> in 8.x ptsname() was changed so that: >> /* Make sure ptsname() does not overwrite errno. */ > > It looks like it was intentional, probably based on: > > http://pubs.opengroup.org/onlinepubs/007904975/functions/ptsname.html: > > ERRORS > > No errors are defined > > I guess this was interpreted as "shall not set errno." > > However - http://austingroupbugs.net/view.php?id=503: > > At line 54750, after "shall return a null pointer", add ", and may set errno". > > At line 54754, replace "No errors are defined." with: > > The ptsname( ) function may fail if: > [EBADF] The fildes argument is not a valid file descriptor. > [ENOTTY] The file associated with the fildes argument is not a master > pseudo-terminal device.. > > There's some further discussion on ENOTTY vs EINVAL there. It looks > like we should at least set errno though: Oh, well in 7.x before MPSAFE TTY ptsname() used to return: [EINVAL] fildes is not a master pseudo-terminal device. and the errors specified for the fstat(2) system call. Probably the only we should change is to turn EINVAL into ENOTTY for !master pt (change __isptmaster()) and return errors from fstat() as is if any. -- wbr, pluknet
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209121410.q8CEA7Pw007687>