From dd85d760da00cca96d92928c7c7f137e1dc8a0ad Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Sun, 16 Jan 2022 17:03:19 +0100 Subject: use ioctl(0, TIOCSCTTY, 0) during startup Only oneshot will grab the controlling tty and release it when they exit; no force needed. --- rvnit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rvnit.c b/rvnit.c index 4f6acab..5d5d24f 100644 --- a/rvnit.c +++ b/rvnit.c @@ -157,7 +157,7 @@ restart(int i) sleep(delay); setsid(); if (services[i].name[2] == 'S' && pid1) - ioctl(0, TIOCSCTTY, 1); + ioctl(0, TIOCSCTTY, 0); execl(services[i].name, services[i].name, (char *)0); @@ -675,6 +675,9 @@ main(int argc, char *argv[]) rescandir(); pthread_mutex_unlock(&services_lock); + if (pid1) + ioctl(0, TIOCNOTTY); + LOG("booting"); int i; @@ -758,9 +761,6 @@ main(int argc, char *argv[]) cont1: pthread_mutex_unlock(&services_lock); } - - if (pid1) - ioctl(0, TIOCSCTTY, 1); // steal back console } sigset_t emptyset; -- cgit 1.4.1