Re: Booting into /bin/bash

From: Miquel van Smoorenburg (miquels@cistron.nl)
Date: Wed Sep 13 2000 - 09:31:27 EST


According to Richard B. Johnson:
> I'm checking on it now. Here's a strace with setsid() ahead, same
> problem:

Yes, sessions, process groups, and controlling ttys are weird
and hard to understand. And probably braindamaged as well, if
not, it's what they cause anyway ;)

If you want to forcibly get a controlling tty:

/* Make sure we do not have a controlling tty. */
ioctl(0, TIOCNOTTY, 0);
close(0);
close(1);
close(2);

/* Become session leader */
setsid();

/* Open tty which will become new controlling tty. */
open("/dev/tty1", O_RDWR);
dup(0);
dup(0);

/* Just to be sure, force controlling tty, in case /dev/tty1
   was the ctty for another process. Only root may do this! */
ioctl(0, TIOCSCTTY, 1);

Mike.

-- 
Deadlock, n.:
	Deceased rastaman.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 15 2000 - 21:00:21 EST