X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=miscutils%2Flast_fancy.c;h=dc09b65fb68d5a25c88c8273170579073ea0e136;hb=604499e5a93d8055a761e968b12d6a0907bc3d0a;hp=2b7fee6e58430e4e76aba2c6a357d62937f160c6;hpb=cd2663f15e74274619dd97dc382bb858ac255872;p=oweals%2Fbusybox.git diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c index 2b7fee6e5..dc09b65fb 100644 --- a/miscutils/last_fancy.c +++ b/miscutils/last_fancy.c @@ -4,11 +4,10 @@ * * Copyright (C) 2008 by Patricia Muscalu * - * Licensed under the GPLv2 or later, see the file LICENSE in this tarball. + * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ #include "libbb.h" -#include /* NB: ut_name and ut_user are the same field, use only one name (ut_user) * to reduce confusion */ @@ -48,8 +47,12 @@ static void show_entry(struct utmp *ut, int state, time_t dur_secs) char logout_time[8]; const char *logout_str; const char *duration_str; + time_t tmp; - safe_strncpy(login_time, ctime(&(ut->ut_tv.tv_sec)), 17); + /* manpages say ut_tv.tv_sec *is* time_t, + * but some systems have it wrong */ + tmp = ut->ut_tv.tv_sec; + safe_strncpy(login_time, ctime(&tmp), 17); snprintf(logout_time, 8, "- %s", ctime(&dur_secs) + 11); dur_secs = MAX(dur_secs - (time_t)ut->ut_tv.tv_sec, (time_t)0); @@ -148,7 +151,7 @@ static int is_runlevel_shutdown(struct utmp *ut) } int last_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -int last_main(int argc ATTRIBUTE_UNUSED, char **argv) +int last_main(int argc UNUSED_PARAM, char **argv) { struct utmp ut; const char *filename = _PATH_WTMP; @@ -158,11 +161,10 @@ int last_main(int argc ATTRIBUTE_UNUSED, char **argv) time_t boot_time; time_t down_time; int file; - unsigned opt; smallint going_down; smallint boot_down; - opt = getopt32(argv, "Wf:" /* "H" */, &filename); + /*opt =*/ getopt32(argv, "Wf:" /* "H" */, &filename); #ifdef BUT_UTIL_LINUX_LAST_HAS_NO_SUCH_OPT if (opt & LAST_OPT_H) { /* Print header line */