Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!masala!metcalf From: metcalf@masala.lcs.mit.edu (Chris Metcalf) Newsgroups: comp.unix.ultrix Subject: Re: Ultrix 4.1 TIOCSPGRP peculiarities -- is this correct behaviour? Message-ID: <1991Mar6.161500.26671@mintaka.lcs.mit.edu> Date: 6 Mar 91 16:15:00 GMT References: <1991Mar5.005456.24515@watcgl.waterloo.edu> <167@sos.com> Sender: daemon@mintaka.lcs.mit.edu (Lucifer Maleficius) Organization: MIT Laboratory for Computer Science Lines: 52 As a result of the funny Ultrix requirements for getting a control tty, if you are writing or porting your own rlogind.c be aware that you have to reset the pgrp after calling vhangup(). The following diff applies to the Kerberos code we're running here. Thanks to Ian Allen for tracking down the problem; TFM certainly doesn't help. Chris Metcalf *** /tmp/,RCSt1001681 Wed Mar 6 11:04:31 1991 --- rlogind.c Wed Mar 6 08:49:08 1991 *************** *** 256,267 **** fatalperror(f, line); if (fchmod(t, 0)) fatalperror(f, line); (void)signal(SIGHUP, SIG_IGN); vhangup(); (void)signal(SIGHUP, SIG_DFL); t = open(line, O_RDWR); if (t < 0) fatalperror(f, line); { struct sgttyb b; --- 264,285 ---- fatalperror(f, line); if (fchmod(t, 0)) fatalperror(f, line); (void)signal(SIGHUP, SIG_IGN); vhangup(); (void)signal(SIGHUP, SIG_DFL); + #ifdef ultrix + /* + * In Ultrix 4.1 (and maybe 4.0), you have to have pgrp = 0 to + * get a controlling tty; it doesn't suffice just to have no + * controlling terminal at open time (yes, the man page lies). + * Chris Metcalf + */ + if (setpgrp(0,0)) + perror("setpgrp(0,0)"); + #endif ultrix t = open(line, O_RDWR); if (t < 0) fatalperror(f, line); { struct sgttyb b; -- Chris Metcalf --- MIT Laboratory for Computer Science email to metcalf@lcs.mit.edu, or phone (617) 253-7766