summaryrefslogtreecommitdiff
path: root/package/busybox/busybox-1.20.0/busybox-1.20.0-getty.patch
blob: ed52159ffe233e612fbd5e31fe1bb05cc5b48319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--- busybox-1.20.0/loginutils/getty.c
+++ busybox-1.20.0-getty/loginutils/getty.c
@@ -561,8 +561,14 @@ int getty_main(int argc UNUSED_PARAM, ch
 		 */
 		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);
 		}
 	}