diff options
author | Karel Zak | 2008-09-29 12:53:39 +0200 |
---|---|---|
committer | Karel Zak | 2008-09-29 13:08:06 +0200 |
commit | a063e16c5d5b9307cb0e027686998677877b1fe9 (patch) | |
tree | 59f688865a807673e474f7d78ee0b62aa71e901e /login-utils/login.c | |
parent | fsck.cramfs: fix compiler warning (diff) | |
download | kernel-qcow2-util-linux-a063e16c5d5b9307cb0e027686998677877b1fe9.tar.gz kernel-qcow2-util-linux-a063e16c5d5b9307cb0e027686998677877b1fe9.tar.xz kernel-qcow2-util-linux-a063e16c5d5b9307cb0e027686998677877b1fe9.zip |
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 <kzak@redhat.com>
Diffstat (limited to 'login-utils/login.c')
-rw-r--r-- | login-utils/login.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/login-utils/login.c b/login-utils/login.c index 16bbba8df..1ae183cad 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)); |