summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko2008-07-09 19:48:43 +0000
committerDenis Vlasenko2008-07-09 19:48:43 +0000
commitd38d38eed3ac270a6bbad59e76f60e45ccce8773 (patch)
tree380801c7e34d5fce31ef86ff9b5cb06f1199d470
parent96c45b0e0bda5bf47c03682c8fcbeae7ade89386 (diff)
downloadbusybox-d38d38eed3ac270a6bbad59e76f60e45ccce8773.zip
busybox-d38d38eed3ac270a6bbad59e76f60e45ccce8773.tar.gz
last: fix ctime(ptr) ptr type mismatch
-rw-r--r--miscutils/last_fancy.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/miscutils/last_fancy.c b/miscutils/last_fancy.c
index 8e63e5c..b4ae574 100644
--- a/miscutils/last_fancy.c
+++ b/miscutils/last_fancy.c
@@ -48,8 +48,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);