Skip to content

Commit dea3ae8

Browse files
committed
Steal controlling TTY on fallback console to enable job control.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
1 parent 9f5172b commit dea3ae8

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

helpers.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,11 @@ pid_t run_getty(char *cmd, char *args[], int console)
593593

594594
sig_unblock();
595595

596+
setsid();
597+
598+
if (ioctl(STDIN_FILENO, TIOCSCTTY, 1) < 0)
599+
_pe("Failed TIOCSCTTY");
600+
596601
while (!fexist(SYNC_SHUTDOWN)) {
597602
static const char msg[] = "\nPlease press Enter to activate this console.";
598603

tty.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void tty_start(finit_tty_t *tty)
144144
#elif defined(GETTY_BUSYBOX)
145145
snprintf(line, sizeof(line), "%s %d %s %s", GETTY, tty->baud, tty->name, tty->term ?: "");
146146
#else
147-
strlcpy(line, FALLBACK_CONSOLE, sizeof(line));
147+
strlcpy(line, FALLBACK_SHELL, sizeof(line));
148148
#endif
149149
} else {
150150
strlcpy(line, tty->name, sizeof(line));

0 commit comments

Comments
 (0)