Jim Meyering <[EMAIL PROTECTED]> 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. _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils