2 On 64-bit platforms such as x86_64, glibc is usally built with 32-bit
3 compatibilty for various structures. One of them is utmp.
5 What this means is that gettimeofday(&ut.ut_tv, NULL) on x86_64 will
6 end up overwriting the first parts of ut_addr_v6, leading to garbage
10 --- util-linux-2.13-pre6/login-utils/login.c.kzak 2006-08-10 11:38:33.000000000 +0200
11 +++ util-linux-2.13-pre6/login-utils/login.c 2006-08-10 11:38:49.000000000 +0200
14 logbtmp(const char *line, const char *username, const char *hostname) {
18 memset(&ut, 0, sizeof(ut));
21 xstrncpy(ut.ut_line, line, sizeof(ut.ut_line));
23 #if defined(_HAVE_UT_TV) /* in <utmpbits.h> included by <utmp.h> */
24 - gettimeofday(&ut.ut_tv, NULL);
25 + gettimeofday(&tv, NULL);
26 + ut.ut_tv.tv_sec = tv.tv_sec;
27 + ut.ut_tv.tv_usec = tv.tv_usec;
40 strncpy(ut.ut_user, username, sizeof(ut.ut_user));
41 xstrncpy(ut.ut_line, tty_name, sizeof(ut.ut_line));
42 #ifdef _HAVE_UT_TV /* in <utmpbits.h> included by <utmp.h> */
43 - gettimeofday(&ut.ut_tv, NULL);
44 + gettimeofday(&tv, NULL);
45 + ut.ut_tv.tv_sec = tv.tv_sec;
46 + ut.ut_tv.tv_usec = tv.tv_usec;