From: Karel Zak Date: Mon, 29 Sep 2008 10:53:39 +0000 (+0200) Subject: login: fix compiler warning (int32 time() arg) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a063e16c5d5b9307cb0e027686998677877b1fe9;p=util-linux login: fix compiler warning (int32 time() arg) login.c: In function ‘dolastlog’: login.c:1438 warning: passing argument 1 of ‘time’ from incompatible pointer type Unfortunately, on-disk lastlog format is always 32bit, bits/utmp.h: struct lastlog { #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 int32_t ll_time; #else __time_t ll_time; #endif Signed-off-by: Karel Zak --- diff --git a/login-utils/login.c b/login-utils/login.c index 16bbba8d..1ae183ca 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -1435,7 +1435,13 @@ dolastlog(int quiet) { lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), SEEK_SET); } memset((char *)&ll, 0, sizeof(ll)); - time(&ll.ll_time); + + { + time_t t; + time(&t); + ll.ll_time = t; /* ll_time is always 32bit */ + } + xstrncpy(ll.ll_line, tty_name, sizeof(ll.ll_line)); if (hostname) xstrncpy(ll.ll_host, hostname, sizeof(ll.ll_host));