[git commit prelink 1/1] libc_utmp: Fix getutmp and getutmpx for x86_64

Carmelo Amoroso carmelo.amoroso at st.com
Sun Nov 28 19:50:38 UTC 2010


commit: http://git.uclibc.org/uClibc/commit/?id=5dea871ac73ef4608022c058b50adc946917f9b9
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink

On x86_64, when WORDSIZE_COMPAT32 is enabled, the ut_tv field
of 'struct utmp' and 'struct utmpx' are defined as two nested structs
instead of being defined as 'struct timeval', so it is not possible to
directly assign the two ut_tv values.
This patch split the assignment by setting each fields (tv_sec, tv_usec)
of the ut_tv filed separately
It is als compatible with 'struct timeval' usage.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso at st.com>
---
 libc/misc/utmp/utxent.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libc/misc/utmp/utxent.c b/libc/misc/utmp/utxent.c
index 3c59f1c..a0e80a6 100644
--- a/libc/misc/utmp/utxent.c
+++ b/libc/misc/utmp/utxent.c
@@ -71,7 +71,8 @@ void getutmp (const struct utmpx *utmpx, struct utmp *utmp)
 	memcpy (utmp->ut_host, utmpx->ut_host, sizeof (utmp->ut_host));
 #endif
 #if _HAVE_UT_TV - 0
-	utmp->ut_tv = utmpx->ut_tv;
+	utmp->ut_tv.tv_sec = utmpx->ut_tv.tv_sec;
+	utmp->ut_tv.tv_usec = utmpx->ut_tv.tv_usec;
 #else
 	utmp->ut_time = utmpx->ut_time;
 #endif
@@ -97,7 +98,8 @@ void getutmpx (const struct utmp *utmp, struct utmpx *utmpx)
 	memcpy (utmpx->ut_host, utmp->ut_host, sizeof (utmp->ut_host));
 #endif
 #if _HAVE_UT_TV - 0
-	utmpx->ut_tv = utmp->ut_tv;
+	utmpx->ut_tv.tv_sec = utmp->ut_tv.tv_sec;
+	utmpx->ut_tv.tv_usec = utmp->ut_tv.tv_usec;
 #else
 	utmpx->ut_time = utmp->ut_time;
 #endif
-- 
1.7.2.2



More information about the uClibc-cvs mailing list