From a063e16c5d5b9307cb0e027686998677877b1fe9 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 29 Sep 2008 12:53:39 +0200 Subject: [PATCH] login: fix compiler warning (int32 time() arg) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- login-utils/login.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)); -- 2.39.5