summary refs log tree commit diff
diff options
context:
space:
mode:
-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;