mirror of
https://github.com/troglobit/finit.git
synced 2026-10-06 07:43:43 +07:00
Restore @console handling and support for external getty
- Drop vhangup(), how did things ever work *with* this in?! - setsid() + TIOCSCTTY are best buds, see notty code - Allow storing any non-NULL string as tty->dev, expand in service_register() - Reorder parse_cmdline_args(), we need to expand @console to current dev - Fix tty arg parser, swapparoo for external getty - Refactor tty_atcon(), iterated over by service_register() - New arg format, need to translate for old run_getty2() Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+5
-4
@@ -245,10 +245,6 @@ static void prepare_tty(char *tty, speed_t speed, char *procname, struct rlimit
|
||||
char name[80];
|
||||
int fd;
|
||||
|
||||
/* Detach from initial controlling TTY and become session leader */
|
||||
vhangup();
|
||||
setsid();
|
||||
|
||||
fd = open(tty, O_RDWR);
|
||||
if (fd < 0) {
|
||||
logit(LOG_ERR, "Failed opening %s: %s", tty, strerror(errno));
|
||||
@@ -260,6 +256,11 @@ static void prepare_tty(char *tty, speed_t speed, char *procname, struct rlimit
|
||||
dup2(fd, STDERR_FILENO);
|
||||
close(fd);
|
||||
|
||||
/*
|
||||
* Become session leader and set controlling TTY
|
||||
* to enable Ctrl-C and job control in shell.
|
||||
*/
|
||||
setsid();
|
||||
if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0)
|
||||
logit(LOG_WARNING, "Failed TIOCSCTTY on %s: %s", tty, strerror(errno));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user