Samuel Thibault, le Wed 21 Jun 2006 01:52:03 +0200, a écrit :
> Sulogin needs patched too, here it is.

Here is a better patch: before starting a new session, it checks thanks
to tcgetsid() whether stdin is the controlling terminal.

Samuel
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,17 @@
                                close(2);
                                close(fd);
                                fd = open(tty, O_RDWR);
-                               ioctl(0, TIOCSCTTY, (char *)1);
                                dup(fd);
                                dup(fd);
                        } else
                                close(fd);
                }
        }
+       if (tcgetsid(0) == -1) {
+               setsid();
+               if (ioctl(0, TIOCSCTTY, (char *)1))
+                       perror("ioctl(TIOCSCTTY)");
+       }
 
        /*
         *      Get the root password.
_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-sysvinit-devel

Reply via email to