mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00: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:
1 parent
37e420bd35
commit
abbc0a1d5c
2 files changed
+12
-1
No files matched your search
@@ -21,7 +21,6 @@ can also be used.
|
|||||||
Before Release
|
Before Release
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
* Ctrl-C does not work properly on "logins" in `nologin` mode
|
|
||||||
* Running `initctl restart foo` in the background blocks
|
* Running `initctl restart foo` in the background blocks
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+12
@@ -252,6 +252,7 @@ int sh(char *tty)
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
size_t len;
|
size_t len;
|
||||||
|
struct termios term;
|
||||||
|
|
||||||
/* Detach from initial controlling TTY */
|
/* Detach from initial controlling TTY */
|
||||||
vhangup();
|
vhangup();
|
||||||
@@ -282,6 +283,17 @@ int sh(char *tty)
|
|||||||
snprintf(arg0, len, "-%s", _PATH_BSHELL);
|
snprintf(arg0, len, "-%s", _PATH_BSHELL);
|
||||||
args[0] = arg0;
|
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);
|
return execv(_PATH_BSHELL, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user