Xref: utzoo comp.unix.wizards:13520 comp.lang.c:14846 Path: utzoo!attcan!uunet!visdc!jiii From: jiii@visdc.UUCP (John E Van Deusen III) Newsgroups: comp.unix.wizards,comp.lang.c Subject: Re: /dev/tty problem (repost) Summary: Similar experiences Keywords: using rn and several other comp.sources Message-ID: <245@visdc.UUCP> Date: 16 Dec 88 22:47:05 GMT References: <373@hrc.UUCP> Organization: VI Software Development Co., Boise, Idaho Lines: 11 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. 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.