add timeval patch

This commit is contained in:
kzak 2006-08-10 10:20:54 +00:00
parent 6a93843038
commit 93a2f57302
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,49 @@
On 64-bit platforms such as x86_64, glibc is usally built with 32-bit
compatibilty for various structures. One of them is utmp.
What this means is that gettimeofday(&ut.ut_tv, NULL) on x86_64 will
end up overwriting the first parts of ut_addr_v6, leading to garbage
in the utmp file.
--- util-linux-2.13-pre6/login-utils/login.c.kzak 2006-08-10 11:38:33.000000000 +0200
+++ util-linux-2.13-pre6/login-utils/login.c 2006-08-10 11:38:49.000000000 +0200
@@ -257,6 +257,7 @@
static void
logbtmp(const char *line, const char *username, const char *hostname) {
struct utmp ut;
+ struct timeval tv;
memset(&ut, 0, sizeof(ut));
@@ -267,7 +268,9 @@
xstrncpy(ut.ut_line, line, sizeof(ut.ut_line));
#if defined(_HAVE_UT_TV) /* in <utmpbits.h> included by <utmp.h> */
- gettimeofday(&ut.ut_tv, NULL);
+ gettimeofday(&tv, NULL);
+ ut.ut_tv.tv_sec = tv.tv_sec;
+ ut.ut_tv.tv_usec = tv.tv_usec;
#else
{
time_t t;
@@ -872,6 +875,7 @@
{
struct utmp ut;
struct utmp *utp;
+ struct timeval tv;
utmpname(_PATH_UTMP);
setutent();
@@ -911,7 +915,9 @@
strncpy(ut.ut_user, username, sizeof(ut.ut_user));
xstrncpy(ut.ut_line, tty_name, sizeof(ut.ut_line));
#ifdef _HAVE_UT_TV /* in <utmpbits.h> included by <utmp.h> */
- gettimeofday(&ut.ut_tv, NULL);
+ gettimeofday(&tv, NULL);
+ ut.ut_tv.tv_sec = tv.tv_sec;
+ ut.ut_tv.tv_usec = tv.tv_usec;
#else
{
time_t t;

View File

@ -9,7 +9,7 @@
Summary: A collection of basic system utilities.
Name: util-linux
Version: 2.13
Release: 0.36
Release: 0.37
License: distributable
Group: System Environment/Base
@ -222,6 +222,8 @@ Patch244: util-linux-2.13-nfs4-posix_types.patch
Patch245: util-linux-2.13-login-ipv6.patch
# fscache bits for NFS mounts
Patch246: util-linux-2.13-nfsmount-fsc.patch
# 176494 - last -i returns strange IP addresses
Patch247: util-linux-2.13-login-timeval.patch
# When adding patches, please make sure that it is easy to find out what bug # the
# patch fixes.
@ -319,6 +321,7 @@ cp %{SOURCE8} %{SOURCE9} .
%patch244 -p1
%patch245 -p1
%patch246 -p1
%patch247 -p1
%build
unset LINGUAS || :
@ -716,6 +719,9 @@ exit 0
/sbin/losetup
%changelog
* Thu Aug 10 2006 Karel Zak <kzak@redhat.com> 2.13-0.37
- fix #176494 - last -i returns strange IP addresses (patch by Bill Nottingham)
* Thu Jul 27 2006 Karel Zak <kzak@redhat.com> 2.13-0.36
- fix #198300, #199557 - util-linux "post" scriptlet failure