[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how does O_NOCTTY help? [Re: bug in chdir-safer
From: |
Paul Eggert |
Subject: |
Re: how does O_NOCTTY help? [Re: bug in chdir-safer |
Date: |
Fri, 10 Feb 2006 14:51:09 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Jim Meyering <address@hidden> writes:
> So O_NOCTTY is definitely worthwhile, if only to avoid
> exposure for the time between an open and close of /dev/tty,
> assuming the process in question already had no controlling terminal.
> Right?
That's the basic idea, but I'm afraid it's a bit more complicated than
that. The process is exposed even after it closes the terminal, since
it doesn't relinquish the controlling terminal even after it closes
the corresponding file descriptor (certainly if other processes have
the terminal open -- even via an independent descriptor -- and on some
systems not even when all processes close all their file descriptors
that access that terminal).
It is tempting to think that we should use O_NOCTTY everywhere we open
a file, but I don't think that's right. For one thing, POSIX doesn't
allow it. I suspect it's more accurate to say that we should
generally use O_NOCTTY when we're opening a file for a reason other
than to read() or write() it.
- how does O_NOCTTY help? [Re: bug in chdir-safer, Jim Meyering, 2006/02/09
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Jim Meyering, 2006/02/09
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Jim Meyering, 2006/02/09
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Paul Eggert, 2006/02/10
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Jim Meyering, 2006/02/10
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer,
Paul Eggert <=
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Jim Meyering, 2006/02/12
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Paul Eggert, 2006/02/12
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Jim Meyering, 2006/02/14
- Re: how does O_NOCTTY help? [Re: bug in chdir-safer, Paul Eggert, 2006/02/14