Disable the use of implicit controlling
TTYs. They will be enabled on demand.
This fixes a bug where 2 or more
consecutive Ctrl-C at the login prompt
triggers a reboot of the device.
Closes: https://github.com/openwrt/openwrt/issues/11306
Signed-off-by: Markus Gothe <markus.gothe@genexis.eu>
if (dfd < 0)
return 0;
- fd = openat(dfd, dev, O_RDONLY);
+ fd = openat(dfd, dev, O_RDONLY|O_NOCTTY);
close(dfd);
if (fd < 0)
return;
}
while (tty!=NULL) {
- f = open(tty, O_RDONLY);
+ f = open(tty, O_RDONLY|O_NOCTTY);
if (f >= 0) {
close(f);
break;
{
int dfd, nfd;
+ flags |= O_NOCTTY;
+
if (device == NULL)
device = "/dev/null";