crash-handler: Call vhangup on /dev/console before spawning crash shell
When pid 1 crashes, the getty unit for the console will happily keep running which means we end up with two shells competing for the same tty. Let's call vhangup on /dev/console to kill every other process attached to the console before we spawn the crash shell. The getty units have Restart=always but lucky for us, pid 1 just crashed in fire and flames so it isn't actually able to restart the getty unit.
This commit is contained in:
@@ -434,6 +434,18 @@ int terminal_vhangup_fd(int fd) {
|
||||
return RET_NERRNO(ioctl(fd, TIOCVHANGUP));
|
||||
}
|
||||
|
||||
int terminal_vhangup(const char *tty) {
|
||||
_cleanup_close_ int fd = -EBADF;
|
||||
|
||||
assert(tty);
|
||||
|
||||
fd = open_terminal(tty, O_RDWR|O_NOCTTY|O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
return terminal_vhangup_fd(fd);
|
||||
}
|
||||
|
||||
int vt_disallocate(const char *tty_path) {
|
||||
assert(tty_path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user