From: devet@adv.win.tue.nl (Arjan de Vet) Subject: Re: Getting login working in 0.99.6 Date: 24 Feb 1993 00:07:27 GMT
In article <C2ww9o.IvL@news.rich.bnr.ca> minyard@crchh7b9 (Corey Minyard)
writes:
|As Linus predicted, 0.99.6 broke login. However, poeigl-1.9a did not
|work! It turns out the new vhangup does not close the terminal, it just
|puts it in an unusable state. The following patch will fix poeigl-1.9a
|to avoid this problem.
|
|Corey
|minyard@bnr.ca
|
|*** ../poeigl.old/./login.c Mon Jan 18 08:40:57 1993
|--- ./login.c Tue Feb 23 11:21:06 1993
|***************
|*** 307,313 ****
| (void)signal(SIGHUP, SIG_DFL);
| setsid();
|
|! /* re-open stdin,stdout,stderr after vhangup() closed them */
| open(ttyn, O_RDWR); open(ttyn, O_RDWR); open(ttyn, O_RDWR);
|
| if (tty = rindex(ttyn, '/'))
|--- 307,315 ----
| (void)signal(SIGHUP, SIG_DFL);
| setsid();
|
|! close(0); close(1); close(2);
|!
|! /* re-open stdin,stdout,stderr */
| open(ttyn, O_RDWR); open(ttyn, O_RDWR); open(ttyn, O_RDWR);
|
| if (tty = rindex(ttyn, '/'))
This solution was also mailed to the KERNEL activists list by Rick Sladkey
some days ago. The solution above works for console logins but NOT for modem
logins because the close()s hangup the modem. This patch works for both
console and modem logins:
--- login.c.orig Mon Jan 18 09:40:57 1993
+++ login.c Tue Feb 23 22:45:59 1993
@@ -302,6 +302,7 @@
ttt.c_cflag &= ~HUPCL;
tcsetattr(0,TCSAFLUSH,&ttt);
vhangup();
+ close(0); close(1); close(2);
tcsetattr(0,TCSAFLUSH,&tt);
}
(void)signal(SIGHUP, SIG_DFL);
Arjan