aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init/init.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/init/init.c b/init/init.c
index edbd90bfe..ec1bacc83 100644
--- a/init/init.c
+++ b/init/init.c
@@ -501,12 +501,11 @@ static pid_t run(struct init_action *a)
501 signal(SIGTSTP, SIG_DFL); 501 signal(SIGTSTP, SIG_DFL);
502 502
503 /* Create a new session and make ourself the process 503 /* Create a new session and make ourself the process
504 * group leader for non-interactive jobs */ 504 * group leader */
505 if ((a->action & (RESPAWN)) == 0) 505 setsid();
506 setsid();
507 506
508 /* Open the new terminal device */ 507 /* Open the new terminal device */
509 if ((device_open(a->terminal, O_RDWR | O_NOCTTY)) < 0) { 508 if ((device_open(a->terminal, O_RDWR)) < 0) {
510 if (stat(a->terminal, &sb) != 0) { 509 if (stat(a->terminal, &sb) != 0) {
511 message(LOG | CONSOLE, "\rdevice '%s' does not exist.\n", 510 message(LOG | CONSOLE, "\rdevice '%s' does not exist.\n",
512 a->terminal); 511 a->terminal);
@@ -516,10 +515,6 @@ static pid_t run(struct init_action *a)
516 _exit(1); 515 _exit(1);
517 } 516 }
518 517
519 /* Non-interactive jobs should not get a controling tty */
520 if ((a->action & (RESPAWN)) == 0)
521 (void) ioctl(0, TIOCSCTTY, 0);
522
523 /* Make sure the terminal will act fairly normal for us */ 518 /* Make sure the terminal will act fairly normal for us */
524 set_term(0); 519 set_term(0);
525 /* Setup stdout, stderr for the new process so 520 /* Setup stdout, stderr for the new process so
@@ -527,11 +522,6 @@ static pid_t run(struct init_action *a)
527 dup(0); 522 dup(0);
528 dup(0); 523 dup(0);
529 524
530 /* For interactive jobs, create a new session
531 * and become the process group leader */
532 if ((a->action & (RESPAWN)))
533 setsid();
534
535 /* If the init Action requires us to wait, then force the 525 /* If the init Action requires us to wait, then force the
536 * supplied terminal to be the controlling tty. */ 526 * supplied terminal to be the controlling tty. */
537 if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) { 527 if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) {