[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#45104: setsid() breakage



   Date: Wed, 22 Sep 1999 18:39:31 -0400
   From: Roland McGrath <roland@gnu.org>

   D'oh!  Ok, I reverted that change and checked in your other fix to login.
   But why did the extra ioctl do harm?

I never get a login prompt when the extra ioctl is present.  The
reason is that the TIOCSTTY fails if the process already has a
controlling terminal.  The setsid() in login_tty() does nothing since
getty already is a session leader.  So the TIOCSTTY ioctl in
login_tty() fails, and login_tty() returns without copying the
filedescriptor for the terminal to filedescriptor 0, 1 and 2.  This
makes the login program fail.

I think it wouldn't hurt to install the appended patch to make
detection of login_tty() failure somewhat easier.

Mark


1999-09-23  Mark Kettenis  <kettenis@gnu.org>

	* getty.c (main): Report an error if login_tty failed.


--- /home/kettenis/CVS/hurd/daemons/getty.c	Tue Sep 21 00:23:12 1999
+++ hurd/daemons/getty.c	Thu Sep 23 15:35:14 1999
@@ -96,7 +96,8 @@
 
   print_banner (tty, ttyname);
 
-  login_tty (tty);
+  if (login_tty (tty) == -1)
+    syslog (LOG_ERR, "cannot set controlling terminal to %s: %m", ttyname);
 
   asprintf (&arg, "TERM=%s", tt ? tt->ty_type : "unknown");
 


Reply to: