mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
Fix Ctrl-C, and signals in general, on "logins" in nologin mode
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -21,7 +21,6 @@ can also be used.
|
||||
Before Release
|
||||
--------------
|
||||
|
||||
* Ctrl-C does not work properly on "logins" in `nologin` mode
|
||||
* Running `initctl restart foo` in the background blocks
|
||||
|
||||
|
||||
|
||||
+12
@@ -252,6 +252,7 @@ int sh(char *tty)
|
||||
NULL
|
||||
};
|
||||
size_t len;
|
||||
struct termios term;
|
||||
|
||||
/* Detach from initial controlling TTY */
|
||||
vhangup();
|
||||
@@ -282,6 +283,17 @@ int sh(char *tty)
|
||||
snprintf(arg0, len, "-%s", _PATH_BSHELL);
|
||||
args[0] = arg0;
|
||||
|
||||
/* Reenable Ctrl-D and Ctrl-C, and ... */
|
||||
if (!tcgetattr(STDIN_FILENO, &term)) {
|
||||
term.c_lflag |= ISIG;
|
||||
term.c_cc[VEOF] = CTL('D');
|
||||
term.c_cc[VINTR] = CTL('C');
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &term);
|
||||
}
|
||||
|
||||
/* ... unblock signals in general */
|
||||
sig_unblock();
|
||||
|
||||
return execv(_PATH_BSHELL, args);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user