- if (pid == 0) {
- /* In child, open the child's side of the tty. */
- int i;
-
- for(i = 0; i <= maxfd; i++)
- close(i);
- /* make new process group */
- setsid();
-
- if (open(tty_name, O_RDWR /*| O_NOCTTY*/) < 0) {
- syslog(LOG_ERR, "Could not open tty");
- exit(1);
- }
- dup(0);
- dup(0);
-
- tcsetpgrp(0, getpid());
-
- /* The pseudo-terminal allocated to the client is configured to operate in
- * cooked mode, and with XTABS CRMOD enabled (see tty(4)).
- */
-
- tcgetattr(0, &termbuf);
- termbuf.c_lflag |= ECHO; /* if we use readline we dont want this */
- termbuf.c_oflag |= ONLCR|XTABS;
- termbuf.c_iflag |= ICRNL;
- termbuf.c_iflag &= ~IXOFF;
- /*termbuf.c_lflag &= ~ICANON;*/
- tcsetattr(0, TCSANOW, &termbuf);
-
- print_login_issue(issuefile, NULL);
-
- /* exec shell, with correct argv and env */
- execv(loginpath, (char *const *)argv_init);
-
- /* NOT REACHED */
- syslog(LOG_ERR, "execv error");
- exit(1);