[Pkg-sysvinit-devel] Bug#374543: sysvinit: ^C and ^Z don't work in emergency mode

Samuel Thibault samuel.thibault at ens-lyon.org
Tue Jun 20 23:52:03 UTC 2006


Hi,

Sulogin needs patched too, here it is. (Yes, it doesn't hurt to
systematically do setsid();ioctl(TIOCSCTTY)).

Samuel
-------------- next part --------------
diff -ur sysvinit-2.86.ds1/src/sulogin.c sysvinit-2.86.ds1youpi/src/sulogin.c
--- sysvinit-2.86.ds1/src/sulogin.c	2004-07-30 13:40:28.000000000 +0200
+++ sysvinit-2.86.ds1youpi/src/sulogin.c	2006-06-21 01:49:54.000000000 +0200
@@ -23,6 +23,7 @@
 #include <pwd.h>
 #include <shadow.h>
 #include <termios.h>
+#include <errno.h>
 #include <sys/ioctl.h>
 #if defined(__GLIBC__)
 #  include <crypt.h>
@@ -410,7 +411,6 @@
 				if (pid != getsid(0)) {
 					if (pid == getpgid(0))
 						setpgid(0, getpgid(getppid()));
-					setsid();
 				}
 
 				signal(SIGHUP, SIG_IGN);
@@ -421,13 +421,15 @@
 				close(2);
 				close(fd);
 				fd = open(tty, O_RDWR);
-				ioctl(0, TIOCSCTTY, (char *)1);
 				dup(fd);
 				dup(fd);
 			} else
 				close(fd);
 		}
 	}
+	setsid();
+	if (ioctl(0, TIOCSCTTY, (char *)1))
+		perror("ioctl(TIOCSCTTY)");
 
 	/*
 	 *	Get the root password.


More information about the Pkg-sysvinit-devel mailing list