- }
-
- alarm ( 0 );
- if ( check_nologin ( pw-> pw_uid == 0 ))
- return EXIT_FAILURE;
-
- setutmp ( username, tty );
- if ( *tty != '/' )
- snprintf ( full_tty, sizeof( full_tty ) - 1, "/dev/%s", tty);
- else
- safe_strncpy ( full_tty, tty, sizeof( full_tty ) - 1 );
-
- if ( !is_my_tty ( full_tty ))
- syslog ( LOG_ERR, "unable to determine TTY name, got %s\n", full_tty );
-
- /* Try these, but don't complain if they fail
- * (for example when the root fs is read only) */
- chown ( full_tty, pw-> pw_uid, pw-> pw_gid );
- chmod ( full_tty, 0600 );
-
- change_identity ( pw );
- setup_environment ( pw-> pw_shell, 1, !opt_preserve, pw );
-
- motd ( );
- signal ( SIGALRM, SIG_DFL ); /* default alarm signal */
-
- if ( pw-> pw_uid == 0 )
- syslog ( LOG_INFO, "root login %s\n", fromhost );
-
- run_shell ( pw-> pw_shell, 1, 0, 0 ); /* exec the shell finally. */
-
- return EXIT_FAILURE;
-}