[PATCH v3 2/2] Use O_IGNORE_CTTY where appropriate
Samuel Thibault
samuel.thibault@gnu.org
Sun Jun 18 21:55:36 GMT 2023
Hello,
Sergey Bugaev, le sam. 10 juin 2023 00:13:22 +0300, a ecrit:
> On Fri, Jun 9, 2023 at 9:37 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
> > You could change the documentation so that it now says that flags that
> > imply O_IGNORE_CTTY are also meaningful. That should be fine.
>
> Perhaps... but there's another reason I don't particularly like the
> idea of doing it on that level.
>
> _hurd_port2fd () and _hurd_intern_fd () is something that you call
> once you already have an io port. O_CREAT and O_DIRECTORY and the rest
> are the flags that impact how you look it up. _hurd_port2fd would have
> to second-guess "this io port is said to have been opened with O_CREAT
> | O_EXCL, so it can't be a ctty". It'd be better to have the caller
> (open) -- that "can see" both looking the port up and interning it --
> implement this bit of logic. Not that this matters for anything,
> because it would still behave the same way no matter which level we
> implement it at; but it seems more appropriate to me to implement it
> at that level.
>
> Samuel, what do you think?
It looks better to me to add a shared helper that adds O_IGNORE_CTTY
whenever the flags contain something that implies it. Callers of
_hurd_intern_fd / _hurd_port2fd can then easily use it (or even just
always pass O_IGNORE_CTTY, when creating a socket for instance).
Samuel
More information about the Libc-alpha
mailing list