summaryrefslogtreecommitdiff
path: root/login
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-10-02 21:03:48 +0000
committerUlrich Drepper <drepper@redhat.com>2002-10-02 21:03:48 +0000
commit4c98451b0e9ec94943c4908d83d76a6d1d6a90ac (patch)
tree139718efddbb199cfb7b929e78200a8b910abb96 /login
parent8e917ed8213804cf92e3b259a73b6c05c6f614ed (diff)
downloadglibc-4c98451b0e9ec94943c4908d83d76a6d1d6a90ac.tar.gz
Update.
2002-10-02 Steven Munroe <sjmunroe@us.ibm.com> Jakub Jelinek <jakub@redhat.com> * login/programs/utmpdump.c (print_entry): Copy up->ut_tv fields to struct timeval temp_tv before printing to be 32-/64-bit agnostic. * sysdeps/powerpc/bits/wordsize.h: Move to... * sysdeps/powerpc/powerpc32/bits/wordsize.h: ...here. (__WORDSIZE_COMPAT32): Define. * sysdeps/powerpc/powerpc64/bits/wordsize.h: Likewise. * sysdeps/sparc/sparc32/bits/wordsize.h (__WORDSIZE_COMPAT32): Define. * sysdeps/sparc/sparc64/bits/wordsize.h (__WORDSIZE_COMPAT32): Define. * sysdeps/s390/bits/wordsize.h: Move to... * sysdeps/s390/s390-32/bits/wordsize.h: ...here. * sysdeps/s390/s390-64/bits/wordsize.h: Likewise. * sysdeps/x86_64/bits/wordsize.h (__WORDSIZE_COMPAT32): Define. * sysdeps/unix/sysv/linux/powerpc/bits/utmp.h: New file. * sysdeps/unix/sysv/linux/powerpc/bits/utmpx.h: New file. * sysdeps/unix/sysv/linux/sparc/bits/utmp.h: New file. * sysdeps/unix/sysv/linux/sparc/bits/utmpx.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/utmp.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/utmpx.h: New file.
Diffstat (limited to 'login')
-rw-r--r--login/programs/utmpdump.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/login/programs/utmpdump.c b/login/programs/utmpdump.c
index d1b5da235c..225b67a265 100644
--- a/login/programs/utmpdump.c
+++ b/login/programs/utmpdump.c
@@ -27,6 +27,17 @@
static void
print_entry (struct utmp *up)
{
+ /* Mixed 32-/64-bit systems may have timeval structs of different sixe
+ but need struct utmp to be the same size. So in 64-bit up->ut_tv may
+ not be a timeval but a struct of __int32_t's. This would cause a compile
+ time warning and a formating error when 32-bit int is passed where
+ a 64-bit long is expected. So copy up->up_tv to a temporary timeval.
+ This is 32-/64-bit agnostic and expands the timeval fields to the
+ expected size as needed. */
+ struct timeval temp_tv;
+ temp_tv.tv_sec = up->ut_tv.tv_sec;
+ temp_tv.tv_usec = up->ut_tv.tv_usec;
+
(printf) (
/* The format string. */
#if _HAVE_UT_TYPE
@@ -62,8 +73,8 @@ print_entry (struct utmp *up)
, up->ut_host
#endif
#if _HAVE_UT_TV
- , 4 + ctime (&up->ut_tv.tv_sec)
- , up->ut_tv.tv_usec
+ , 4 + ctime (&temp_tv.tv_sec)
+ , temp_tv.tv_usec
#else
, 4 + ctime (&up->ut_time)
#endif