mirror of
https://github.com/sheumann/hush.git
synced 2025-01-11 08:29:54 +00:00
getty: fix for NOCTTY killing us with SIGHUP
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
b84dafb5e5
commit
eced0c78a5
@ -561,8 +561,14 @@ int getty_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
*/
|
*/
|
||||||
fd = open("/dev/tty", O_RDWR | O_NONBLOCK);
|
fd = open("/dev/tty", O_RDWR | O_NONBLOCK);
|
||||||
if (fd >= 0) {
|
if (fd >= 0) {
|
||||||
|
/* TIOCNOTTY sends SIGHUP to the foreground
|
||||||
|
* process group - which may include us!
|
||||||
|
* Make sure to not die on it:
|
||||||
|
*/
|
||||||
|
sighandler_t old = signal(SIGHUP, SIG_IGN);
|
||||||
ioctl(fd, TIOCNOTTY);
|
ioctl(fd, TIOCNOTTY);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
signal(SIGHUP, old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user