From 93a2f57302622ca54f635a537da2586fa58a3f39 Mon Sep 17 00:00:00 2001 From: kzak Date: Thu, 10 Aug 2006 10:20:54 +0000 Subject: [PATCH] add timeval patch --- util-linux-2.13-login-timeval.patch | 49 +++++++++++++++++++++++++++++ util-linux.spec | 8 ++++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 util-linux-2.13-login-timeval.patch diff --git a/util-linux-2.13-login-timeval.patch b/util-linux-2.13-login-timeval.patch new file mode 100644 index 0000000..2f8e46a --- /dev/null +++ b/util-linux-2.13-login-timeval.patch @@ -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 included by */ +- 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 included by */ +- 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; diff --git a/util-linux.spec b/util-linux.spec index 3d38359..4a03355 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -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 2.13-0.37 +- fix #176494 - last -i returns strange IP addresses (patch by Bill Nottingham) + * Thu Jul 27 2006 Karel Zak 2.13-0.36 - fix #198300, #199557 - util-linux "post" scriptlet failure