-/* returns 1 if true */
-static int is_my_tty ( const char *tty )
-{
- struct stat by_name, by_fd;
-
- if ( stat ( tty, &by_name ) || fstat ( 0, &by_fd ))
- return 0;
-
- if ( by_name. st_rdev != by_fd. st_rdev )
- return 0;
- else
- return 1;
-}
-
-
-static void motd (void)
-{
- FILE *fp;
- register int c;
-
- if (( fp = fopen ( bb_path_motd_file, "r" ))) {
- while (( c = getc ( fp )) != EOF )
- putchar ( c );
- fclose ( fp );
- }
-}
-
-
-#ifdef CONFIG_FEATURE_UTMP
-// vv Taken from tinylogin utmp.c vv
-
-#define NO_UTENT \
- "No utmp entry. You must exec \"login\" from the lowest level \"sh\""
-#define NO_TTY \
- "Unable to determine your tty name."
-
-/*
- * checkutmp - see if utmp file is correct for this process
- *
- * System V is very picky about the contents of the utmp file
- * and requires that a slot for the current process exist.
- * The utmp file is scanned for an entry with the same process
- * ID. If no entry exists the process exits with a message.
- *
- * The "picky" flag is for network and other logins that may
- * use special flags. It allows the pid checks to be overridden.
- * This means that getty should never invoke login with any
- * command line flags.
- */
-
-static void checkutmp(int picky)
-{
- char *line;
- struct utmp *ut;
- pid_t pid = getpid();
-
- setutent();
-
- /* First, try to find a valid utmp entry for this process. */
- while ((ut = getutent()))
- if (ut->ut_pid == pid && ut->ut_line[0] && ut->ut_id[0] &&
- (ut->ut_type == LOGIN_PROCESS || ut->ut_type == USER_PROCESS))
- break;
-
- /* If there is one, just use it, otherwise create a new one. */
- if (ut) {
- utent = *ut;
- } else {
- time_t t_tmp;
-
- if (picky) {
- puts(NO_UTENT);
- exit(1);
- }
- line = ttyname(0);
- if (!line) {
- puts(NO_TTY);
- exit(1);
- }
- if (strncmp(line, "/dev/", 5) == 0)
- line += 5;
- memset((void *) &utent, 0, sizeof utent);
- utent.ut_type = LOGIN_PROCESS;
- utent.ut_pid = pid;
- strncpy(utent.ut_line, line, sizeof utent.ut_line);
- /* XXX - assumes /dev/tty?? */
- strncpy(utent.ut_id, utent.ut_line + 3, sizeof utent.ut_id);
- strncpy(utent.ut_user, "LOGIN", sizeof utent.ut_user);
- t_tmp = (time_t)utent.ut_time;
- time(&t_tmp);
- }
-}
-
-/*
- * setutmp - put a USER_PROCESS entry in the utmp file
- *
- * setutmp changes the type of the current utmp entry to
- * USER_PROCESS. the wtmp file will be updated as well.
- */
-
-static void setutmp(const char *name, const char *line ATTRIBUTE_UNUSED)
-{
- time_t t_tmp = (time_t)utent.ut_time;
-
- utent.ut_type = USER_PROCESS;
- strncpy(utent.ut_user, name, sizeof utent.ut_user);
- time(&t_tmp);
- /* other fields already filled in by checkutmp above */
- setutent();
- pututline(&utent);
- endutent();
-#ifdef CONFIG_FEATURE_WTMP
- if (access(_PATH_WTMP, R_OK|W_OK) == -1) {
- close(creat(_PATH_WTMP, 0664));
- }
- updwtmp(_PATH_WTMP, &utent);
-#endif
+ // util-linux login also does:
+ // /* start new session */
+ // setsid();
+ // /* TIOCSCTTY: steal tty from other process group */
+ // if (ioctl(0, TIOCSCTTY, 1)) error_msg...
+ // BBox login used to do this (see above):
+ // bb_setpgrp();
+ // If this stuff is really needed, add it and explain why!
+
+ /* set signals to defaults */
+ signal(SIGALRM, SIG_DFL);
+ /* Is this correct? This way user can ctrl-c out of /etc/profile,
+ * potentially creating security breach (tested with bash 3.0).
+ * But without this, bash 3.0 will not enable ctrl-c either.
+ * Maybe bash is buggy?
+ * Need to find out what standards say about /bin/login -
+ * should it leave SIGINT etc enabled or disabled? */
+ signal(SIGINT, SIG_DFL);
+
+ /* Exec login shell with no additional parameters */
+ run_shell(tmp, 1, NULL, NULL);
+
+ /* return EXIT_FAILURE; - not reached */