* remotely meaningful by skipping "tty"... */
strncpy(utptr->ut_id, short_tty + 3, sizeof(utptr->ut_id));
strncpy(utptr->ut_user, "LOGIN", sizeof(utptr->ut_user));
- utptr->ut_time = time(NULL);
+ utptr->ut_tv.tv_sec = time(NULL);
}
if (!picky) /* root login */
memset(utptr->ut_host, 0, sizeof(utptr->ut_host));
{
utptr->ut_type = USER_PROCESS;
strncpy(utptr->ut_user, username, sizeof(utptr->ut_user));
- utptr->ut_time = time(NULL);
+ utptr->ut_tv.tv_sec = time(NULL);
/* other fields already filled in by read_or_build_utent above */
setutent();
pututline(utptr);
fclose(fp);
} else
puts("\r\nSystem closed for routine maintenance\r");
- exit(1);
+ exit(EXIT_FAILURE);
}
#else
static ALWAYS_INLINE void die_if_nologin(void) {}
/* skip whitespace */
do {
c = getchar();
- if (c == EOF) exit(1);
+ if (c == EOF) exit(EXIT_FAILURE);
if (c == '\n') {
- if (!--cntdown) exit(1);
+ if (!--cntdown) exit(EXIT_FAILURE);
goto prompt;
}
} while (isspace(c));
*buf++ = c;
if (!fgets(buf, size_buf-2, stdin))
- exit(1);
+ exit(EXIT_FAILURE);
if (!strchr(buf, '\n'))
- exit(1);
+ exit(EXIT_FAILURE);
while (isgraph(*buf)) buf++;
*buf = '\0';
}
}
}
-static void alarm_handler(int sig ATTRIBUTE_UNUSED)
+static void alarm_handler(int sig UNUSED_PARAM)
{
/* This is the escape hatch! Poor serial line users and the like
* arrive here when their connection is broken.
}
int login_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int login_main(int argc, char **argv)
+int login_main(int argc UNUSED_PARAM, char **argv)
{
enum {
LOGIN_OPT_f = (1<<0),
bb_error_msg_and_die("-f is for root only");
safe_strncpy(username, opt_user, sizeof(username));
}
- if (optind < argc) /* user from command line (getty) */
- safe_strncpy(username, argv[optind], sizeof(username));
+ argv += optind;
+ if (argv[0]) /* user from command line (getty) */
+ safe_strncpy(username, argv[0], sizeof(username));
/* Let's find out and memorize our tty */
if (!isatty(0) || !isatty(1) || !isatty(2))