From e9698175b0b60407db1e89bcf29437ab224bca0b Mon Sep 17 00:00:00 2001 From: Lukasz Majewski Date: Mon, 16 Mar 2020 08:31:41 +0100 Subject: y2038: Replace __clock_gettime with __clock_gettime64 The __clock_gettime internal function is not supporting 64 bit time on architectures with __WORDSIZE == 32 and __TIMESIZE != 64 (like e.g. ARM 32 bit). The __clock_gettime64 function shall be used instead in the glibc itself as it supports 64 bit time on those systems. This patch does not bring any changes to systems with __WORDSIZE == 64 as for them the __clock_gettime64 is aliased to __clock_gettime (in ./include/time.h). --- login/logout.c | 4 ++-- login/logwtmp.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'login') diff --git a/login/logout.c b/login/logout.c index 7653fe8886..091312eb1d 100644 --- a/login/logout.c +++ b/login/logout.c @@ -47,8 +47,8 @@ logout (const char *line) memset (ut->ut_name, '\0', sizeof ut->ut_name); memset (ut->ut_host, '\0', sizeof ut->ut_host); - struct timespec ts; - __clock_gettime (CLOCK_REALTIME, &ts); + struct __timespec64 ts; + __clock_gettime64 (CLOCK_REALTIME, &ts); TIMESPEC_TO_TIMEVAL (&ut->ut_tv, &ts); ut->ut_type = DEAD_PROCESS; diff --git a/login/logwtmp.c b/login/logwtmp.c index 90406acc3d..050219c153 100644 --- a/login/logwtmp.c +++ b/login/logwtmp.c @@ -21,6 +21,7 @@ #include #include #include +#include void @@ -36,8 +37,8 @@ logwtmp (const char *line, const char *name, const char *host) strncpy (ut.ut_name, name, sizeof ut.ut_name); strncpy (ut.ut_host, host, sizeof ut.ut_host); - struct timespec ts; - __clock_gettime (CLOCK_REALTIME, &ts); + struct __timespec64 ts; + __clock_gettime64 (CLOCK_REALTIME, &ts); TIMESPEC_TO_TIMEVAL (&ut.ut_tv, &ts); updwtmp (_PATH_WTMP, &ut); -- cgit 1.4.1