This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] grantpt errno values


On Mon, Dec 10, Ulrich Drepper wrote:

> Thorsten Kukuk <kukuk@suse.de> writes:
> 
> > --- sysdeps/unix/sysv/linux/ptsname.c
> > +++ sysdeps/unix/sysv/linux/ptsname.c	2001/12/10 09:31:15
> > @@ -85,8 +85,7 @@
> >  
> >    if (!__isatty (fd))
> >      {
> > -      __set_errno (ENOTTY);
> > -      return ENOTTY;
> > +      return errno;
> >      }
> 
> That this change works for you is only a side effect of the current
> implementation of isatty().  This functions isn't required to set
> errno to a specific value.

But the Austin draft writes something other about isatty:

20762 RETURN VALUE
20763              The isatty( ) function shall return 1 if fildes is associated
 with a terminal; otherwise, it shall return
20764              0 and may set errno to indicate the error.

20765 ERRORS
20766              The isatty( ) function may fail if:
20767              [EBADF]              The fildes argument is not a valid open 
file descriptor.
20768              [ENOTTY]             The fildes argument is not associated wi
th a terminal.

I would say, if the file descriptor is not valid, errno has to be EBADF
and ENOTTY if it is not associated with a TTY.

> In which case did you see a wrong errno value?  This must be
> discovered differently.

I need the case EBADF for a not valid open file descriptor and EINVAL
in the case where isatty and later other checks in pts_name_r returns
ENOTTY.

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE GmbH            Deutschherrenstr. 15-19       D-90429 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]