about summary refs log tree commit diff
path: root/login
diff options
context:
space:
mode:
Diffstat (limited to 'login')
-rw-r--r--login/logout.c10
-rw-r--r--login/logwtmp.c10
2 files changed, 18 insertions, 2 deletions
diff --git a/login/logout.c b/login/logout.c
index 41c864a0a4..020ff6189a 100644
--- a/login/logout.c
+++ b/login/logout.c
@@ -51,7 +51,15 @@ logout (const char *line)
       bzero (ut->ut_host, sizeof ut->ut_host);
 #endif
 #if _HAVE_UT_TV - 0
-      gettimeofday (&ut->ut_tv, NULL);
+  if (sizeof (ut->ut_tv) == sizeof (struct timeval))
+    __gettimeofday ((struct timeval *) &ut->ut_tv, NULL);
+  else
+    {
+      struct timeval tv;
+      __gettimeofday (&tv, NULL);
+      ut->ut_tv.tv_sec = tv.tv_sec;
+      ut->ut_tv.tv_usec = tv.tv_usec;
+    }
 #else
       ut->ut_time = time (NULL);
 #endif
diff --git a/login/logwtmp.c b/login/logwtmp.c
index 68a8f8f5b5..96ef05d795 100644
--- a/login/logwtmp.c
+++ b/login/logwtmp.c
@@ -44,7 +44,15 @@ logwtmp (const char *line, const char *name, const char *host)
 #endif
 
 #if _HAVE_UT_TV - 0
-  __gettimeofday (&ut.ut_tv, NULL);
+  if (sizeof (ut.ut_tv) == sizeof (struct timeval))
+    __gettimeofday ((struct timeval *) &ut.ut_tv, NULL);
+  else
+    {
+      struct timeval tv;
+      __gettimeofday (&tv, NULL);
+      ut.ut_tv.tv_sec = tv.tv_sec;
+      ut.ut_tv.tv_usec = tv.tv_usec;
+    }
 #else
   ut.ut_time = time (NULL);
 #endif