This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
FreeBSD port (53): avoid assumptions about ut_time
- From: Bruno Haible <bruno at clisp dot org>
- To: libc-alpha at sources dot redhat dot com
- Date: Fri, 20 Sep 2002 16:17:55 +0200 (CEST)
- Subject: FreeBSD port (53): avoid assumptions about ut_time
On FreeBSD/alpha, the 'struct utmp' field ut_time is a 32-bit integer,
but I'm using a time_t type equivalent to long (64-bit). To avoid
mixing pointers to 32-bit and 64-bit integers, here is a portability change.
2002-09-18 Bruno Haible <bruno@clisp.org>
* login/logout.c (logout): Don't assume ut_time has the same size as
a time_t.
* login/logwtmp.c (logwtmp): Likewise.
diff -r -c3 glibc-20020910.bak/login/logout.c glibc-20020910/login/logout.c
*** glibc-20020910.bak/login/logout.c Tue Jul 10 22:59:11 2001
--- glibc-20020910/login/logout.c Wed Sep 18 01:30:35 2002
***************
*** 1,4 ****
! /* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
--- 1,4 ----
! /* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
***************
*** 53,59 ****
#if _HAVE_UT_TV - 0
gettimeofday (&ut->ut_tv, NULL);
#else
! time (&ut->ut_time);
#endif
#if _HAVE_UT_TYPE - 0
ut->ut_type = DEAD_PROCESS;
--- 53,59 ----
#if _HAVE_UT_TV - 0
gettimeofday (&ut->ut_tv, NULL);
#else
! ut->ut_time = time (NULL);
#endif
#if _HAVE_UT_TYPE - 0
ut->ut_type = DEAD_PROCESS;
diff -r -c3 glibc-20020910.bak/login/logwtmp.c glibc-20020910/login/logwtmp.c
*** glibc-20020910.bak/login/logwtmp.c Tue Jul 10 22:59:11 2001
--- glibc-20020910/login/logwtmp.c Wed Sep 18 01:31:21 2002
***************
*** 1,4 ****
! /* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
--- 1,4 ----
! /* Copyright (C) 1996, 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
***************
*** 46,52 ****
#if _HAVE_UT_TV - 0
__gettimeofday (&ut.ut_tv, NULL);
#else
! time (&ut.ut_time);
#endif
updwtmp (_PATH_WTMP, &ut);
--- 46,52 ----
#if _HAVE_UT_TV - 0
__gettimeofday (&ut.ut_tv, NULL);
#else
! ut.ut_time = time (NULL);
#endif
updwtmp (_PATH_WTMP, &ut);