Always pass ttyname to sulogin
This commit is contained in:
parent
3383221834
commit
2fd8225c6a
13
src/rc.c
13
src/rc.c
@ -36,6 +36,7 @@
|
|||||||
#define INITSH RC_LIBDIR "sh/init.sh"
|
#define INITSH RC_LIBDIR "sh/init.sh"
|
||||||
#define INITEARLYSH RC_LIBDIR "sh/init-early.sh"
|
#define INITEARLYSH RC_LIBDIR "sh/init-early.sh"
|
||||||
#define HALTSH RC_INITDIR "halt.sh"
|
#define HALTSH RC_INITDIR "halt.sh"
|
||||||
|
#define SULOGIN "/sbin/sulogin"
|
||||||
|
|
||||||
#define RC_SVCDIR_STARTING RC_SVCDIR "starting/"
|
#define RC_SVCDIR_STARTING RC_SVCDIR "starting/"
|
||||||
#define RC_SVCDIR_INACTIVE RC_SVCDIR "inactive/"
|
#define RC_SVCDIR_INACTIVE RC_SVCDIR "inactive/"
|
||||||
@ -393,14 +394,22 @@ static void sulogin (bool cont)
|
|||||||
|
|
||||||
if (cont) {
|
if (cont) {
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
#ifdef __linux__
|
||||||
|
char *tty = ttyname (fileno (stdout));
|
||||||
|
#endif
|
||||||
|
|
||||||
pid_t pid = vfork ();
|
pid_t pid = vfork ();
|
||||||
|
|
||||||
if (pid == -1)
|
if (pid == -1)
|
||||||
eerrorx ("%s: vfork: %s", applet, strerror (errno));
|
eerrorx ("%s: vfork: %s", applet, strerror (errno));
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
execle ("/sbin/sulogin", "/sbin/sulogin", (char *) NULL, newenv);
|
if (tty)
|
||||||
eerror ("%s: unable to exec `/sbin/sulogin': %s", applet,
|
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));
|
strerror (errno));
|
||||||
#else
|
#else
|
||||||
execle ("/bin/sh", "/bin/sh", (char *) NULL, newenv);
|
execle ("/bin/sh", "/bin/sh", (char *) NULL, newenv);
|
||||||
|
Loading…
Reference in New Issue
Block a user