[Pkg-shadow-devel] Bug#380522: X is unexpected signal
Samuel Thibault
samuel.thibault at ens-lyon.org
Thu Aug 3 21:04:01 UTC 2006
Hi,
Nicolas François, le Thu 03 Aug 2006 22:21:14 +0200, a écrit :
> On Thu, Aug 03, 2006 at 09:47:26PM +0200, Samuel Thibault wrote:
> >
> > + /* If we were init, we need to start the session */
> > + if (getppid() == 1) {
> > + setsid();
> > + if (ioctl(0, TIOCSCTTY, 1))
> > + fprintf(stderr,_("TIOCSCTTY failed on %s"),tty);
> > + }
>
> Is there another way to detect when a new session is necessary?
>
> i.e. Is there a way to predict that ^Z and ^C will fail?
Oh, actually, there is indeed: (tcgetsid(STDIN_FILENO) != -1) is a posix
way to check that stdin is the controlling terminal of the processus,
(it returns the session id).
> Testing the PID could fail with kernel patches that randomize the PIDs.
Well, init must have pid 1 else this is not unix.
> Also, I really don't know what the users expect when they use
> init=/bin/login
They expect a more sane environment than just using init=/bin/sh. As
quoted from linux-kernel: « The real solution is for [people who use
init=/bin/sh] to specify a different init= or run/exec something to set
up their tty and session once logged in. », i.e. login for instance.
Samuel
More information about the Pkg-shadow-devel
mailing list