On 64bit arches which have 32bit multilib support, the utmp struct is the same ... thus we cannot assume that utmp.ut_tv is of type time_t --- sysvinit/src/utmp.c +++ sysvinit/src/utmp.c @@ -47,6 +47,7 @@ void write_wtmp int fd; struct utmp utmp; struct utsname uname_buf; + struct timeval tv; /* * Try to open the wtmp file. Note that we even try @@ -76,7 +77,9 @@ void write_wtmp */ memset(&utmp, 0, sizeof(utmp)); #if defined(__GLIBC__) - gettimeofday(&utmp.ut_tv, NULL); + gettimeofday(&tv, NULL); + utmp.ut_tv.tv_sec = tv.tv_sec; + utmp.ut_tv.tv_usec = tv.tv_usec; #else time(&utmp.ut_time); #endif @@ -113,6 +116,7 @@ static void write_utmp struct utmp utmp; struct utmp tmp; struct utmp *utmptr; + struct timeval tv; /* * Can't do much if UTMP_FILE is not present. @@ -144,7 +148,9 @@ static void write_utmp utmp.ut_pid = pid; strncpy(utmp.ut_id, id, sizeof(utmp.ut_id)); #if defined(__GLIBC__) - gettimeofday(&utmp.ut_tv, NULL); + gettimeofday(&tv, NULL); + utmp.ut_tv.tv_sec = tv.tv_sec; + utmp.ut_tv.tv_usec = tv.tv_usec; #else time(&utmp.ut_time); #endif