From eced0c78a54bbecc61f1717d33f64ee7d99804bb Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 26 Apr 2012 10:53:48 +0200 Subject: getty: fix for NOCTTY killing us with SIGHUP Signed-off-by: Denys Vlasenko --- loginutils/getty.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'loginutils') diff --git a/loginutils/getty.c b/loginutils/getty.c index afb411b..bbb5a96 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c @@ -561,8 +561,14 @@ int getty_main(int argc UNUSED_PARAM, char **argv) */ fd = open("/dev/tty", O_RDWR | O_NONBLOCK); 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); close(fd); + signal(SIGHUP, old); } } -- cgit v1.1