/dev/tty problem (repost)
John E Van Deusen III
jiii at visdc.UUCP
Sat Dec 17 08:47:05 AEST 1988
I once had a similar problem opening /dev/tty with a program that was
running in a pipe line but needed to fork an interactive shell every
so often. In order to have access to the terminal, I invoked the
shell command exec </dev/tty >/dev/tty. If I then attempted to su(1)
to another uid, the standard input would not be readable. The reason
was that the permissions and ownerships from the previous uid had
somehow remained in effect. The curious thing was that this would only
happen if the input and output had previously been redirected to pipes.
As I recall, exec 0<&2 1>&2 solved the problem, so I would suggest that
you dup(2) the standard error file file descriptor. This has the added
advantage that /etc/ttytype remains useful.
More information about the Comp.unix.wizards
mailing list