From 2fd8225c6ae47e13956deb7b0aa8c838be243a86 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 3 May 2007 13:46:38 +0000 Subject: Always pass ttyname to sulogin --- src/rc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/rc.c b/src/rc.c index 0ecbb020..946a7a94 100644 --- a/src/rc.c +++ b/src/rc.c @@ -36,6 +36,7 @@ #define INITSH RC_LIBDIR "sh/init.sh" #define INITEARLYSH RC_LIBDIR "sh/init-early.sh" #define HALTSH RC_INITDIR "halt.sh" +#define SULOGIN "/sbin/sulogin" #define RC_SVCDIR_STARTING RC_SVCDIR "starting/" #define RC_SVCDIR_INACTIVE RC_SVCDIR "inactive/" @@ -393,14 +394,22 @@ static void sulogin (bool cont) if (cont) { int status = 0; +#ifdef __linux__ + char *tty = ttyname (fileno (stdout)); +#endif + pid_t pid = vfork (); if (pid == -1) eerrorx ("%s: vfork: %s", applet, strerror (errno)); if (pid == 0) { #ifdef __linux__ - execle ("/sbin/sulogin", "/sbin/sulogin", (char *) NULL, newenv); - eerror ("%s: unable to exec `/sbin/sulogin': %s", applet, + if (tty) + execle (SULOGIN, SULOGIN, tty, (char *) NULL, newenv); + else + execle (SULOGIN, SULOGIN, (char *) NULL, newenv); + + eerror ("%s: unable to exec `%s': %s", applet, SULOGIN, strerror (errno)); #else execle ("/bin/sh", "/bin/sh", (char *) NULL, newenv); -- cgit v1.2.3