Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 12 Sep 2018 23:26:21 -0400
From: Rich Felker <>
Subject: Re: [PATCH] return EBADF from ttyname_r

On Wed, Sep 12, 2018 at 10:23:37PM -0500, A. Wilcox wrote:
> On 09/12/18 21:07, Rich Felker wrote:
> > The EBADF error for isatty is optional and musl's does not set it, so
> > this patch does not work as-is. I think returning ENOTTY for cases for
> > which it does not apply in ttyname_r is non-conforming though, so
> > some change similar to this is probably needed. If isatty were
> > modified to set errno, I think we could just return errno here.
> Please do feel free to work on isatty's error handling, though, Benjamin
> (or others).
> It is non-conformant as it stands; it returns 0 for /dev/null and it
> does not error on a closed fd.

These are "may fail" errors. The only mandate is that isatty return 1
if the argument is a fd for a tty and 0 otherwise. But the related
ttyname_r issue reported here makes it clear that choosing to follow
that "may" is the right choice for a simple implementation, I think.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.