Hi, Nicolas François, le Mon 31 Jul 2006 22:44:01 +0200, a écrit : > Samuel, do you think this is related to the patch you sent to #374547 ?
It looks like it is: my patch spuriously starts sessions even on regular linux consoles. Here is a corrected one. Samuel
Goal: Make login initialize a session to allow ^C and ^Z to work when booting with init=/bin/login Fix: #374547 Author: Samuel Thibault <[EMAIL PROTECTED]> Status wrt upstream: reported, not applied yet Index: shadow-4.0.17/src/login.c =================================================================== --- shadow-4.0.17.orig/src/login.c 2006-07-14 09:25:51.806234220 +0200 +++ shadow-4.0.17/src/login.c 2006-07-14 09:31:59.645240541 +0200 @@ -41,6 +41,7 @@ #include <signal.h> #include <stdio.h> #include <sys/stat.h> +#include <sys/ioctl.h> #include "defines.h" #include "faillog.h" #include "failure.h" @@ -1046,6 +1047,12 @@ } /* child */ #endif + /* 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); + } /* We call set_groups() above because this clobbers pam_groups.so */ #ifndef USE_PAM Index: shadow-4.0.17/src/sulogin.c =================================================================== --- shadow-4.0.17.orig/src/sulogin.c 2006-05-13 01:13:10.000000000 +0200 +++ shadow-4.0.17/src/sulogin.c 2006-07-14 09:31:59.669240742 +0200 @@ -35,6 +35,7 @@ #include <pwd.h> #include <signal.h> #include <stdio.h> +#include <sys/ioctl.h> #include "defines.h" #include "getdef.h" #include "prototypes.h" @@ -142,6 +143,12 @@ #endif exit (1); /* must be a terminal */ } + /* If we were init, we need to start the session */ + if (getppid() == 1) { + setsid(); + if (ioctl(0, TIOCSCTTY, 1)) + fprintf(stderr,_("TIOCSCTTY failed")); + } while (*envp) /* add inherited environment, */ addenv (*envp++, NULL); /* some variables change later */