mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
Make sure to _exit() TTY child also on error
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
460add3cae
commit
3d50a28fe3
1 file changed
+13
-4
+13
-4
@@ -386,12 +386,15 @@ pid_t run_getty(char *tty, char *baud, char *term, int noclear, int nowait, stru
|
|||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
speed_t speed;
|
speed_t speed;
|
||||||
|
int rc = 1;
|
||||||
|
|
||||||
speed = stty_parse_speed(baud);
|
speed = stty_parse_speed(baud);
|
||||||
logit(LOG_INFO, "Starting built-in getty on %s, speed %u", tty, speed);
|
logit(LOG_INFO, "Starting built-in getty on %s, speed %u", tty, speed);
|
||||||
prepare_tty(tty, speed, "tty", rlimit);
|
prepare_tty(tty, speed, "tty", rlimit);
|
||||||
if (activate_console(noclear, nowait))
|
if (activate_console(noclear, nowait))
|
||||||
_exit(getty(tty, speed, term, NULL));
|
rc = getty(tty, speed, term, NULL);
|
||||||
|
|
||||||
|
_exit(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
@@ -403,14 +406,16 @@ pid_t run_getty2(char *tty, char *cmd, char *args[], int noclear, int nowait, st
|
|||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
|
int rc = 1;
|
||||||
|
|
||||||
/* Dunno speed, tell stty() to not mess with it */
|
/* Dunno speed, tell stty() to not mess with it */
|
||||||
logit(LOG_INFO, "Starting external getty on %s, speed %u", tty, B0);
|
logit(LOG_INFO, "Starting external getty on %s, speed %u", tty, B0);
|
||||||
prepare_tty(tty, B0, "getty", rlimit);
|
prepare_tty(tty, B0, "getty", rlimit);
|
||||||
if (activate_console(noclear, nowait))
|
if (activate_console(noclear, nowait))
|
||||||
_exit(execv(cmd, args));
|
rc = execv(cmd, args);
|
||||||
|
|
||||||
vhangup();
|
vhangup();
|
||||||
exit(0);
|
_exit(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
@@ -422,9 +427,13 @@ pid_t run_sh(char *tty, int noclear, int nowait, struct rlimit rlimit[])
|
|||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
|
int rc = 1;
|
||||||
|
|
||||||
prepare_tty(tty, B0, "finit-sh", rlimit);
|
prepare_tty(tty, B0, "finit-sh", rlimit);
|
||||||
if (activate_console(noclear, nowait))
|
if (activate_console(noclear, nowait))
|
||||||
_exit(sh(tty));
|
rc = sh(tty);
|
||||||
|
|
||||||
|
_exit(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
|
|||||||
Reference in new issue
Block a user