summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2022-01-16 17:03:19 +0100
committerLeah Neukirchen <leah@vuxu.org>2022-01-16 17:04:19 +0100
commitdd85d760da00cca96d92928c7c7f137e1dc8a0ad (patch)
treeb85457daba000ee273af8891333b83f55aee6661
parent2f7a6bdb8a581fe9a8ba81c9309d7aced7957092 (diff)
downloadrvnit-dd85d760da00cca96d92928c7c7f137e1dc8a0ad.tar.gz
rvnit-dd85d760da00cca96d92928c7c7f137e1dc8a0ad.tar.xz
rvnit-dd85d760da00cca96d92928c7c7f137e1dc8a0ad.zip
use ioctl(0, TIOCSCTTY, 0) during startup
Only oneshot will grab the controlling tty and release it when they
exit; no force needed.
-rw-r--r--rvnit.c8
1 files 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;