aboutsummaryrefslogtreecommitdiff
path: root/nis/nis_call.c
diff options
context:
space:
mode:
authorLukasz Majewski <lukma@denx.de>2020-03-16 08:31:41 +0100
committerLukasz Majewski <lukma@denx.de>2020-05-20 16:45:16 +0200
commite9698175b0b60407db1e89bcf29437ab224bca0b (patch)
treecb1b6779101327e185e1868b5200cc8a06e98c0b /nis/nis_call.c
parent5b9b177bf62bcdaf42255f88ad9ebf090528c5e1 (diff)
downloadglibc-e9698175b0b60407db1e89bcf29437ab224bca0b.zip
glibc-e9698175b0b60407db1e89bcf29437ab224bca0b.tar.gz
glibc-e9698175b0b60407db1e89bcf29437ab224bca0b.tar.bz2
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).
Diffstat (limited to 'nis/nis_call.c')
-rw-r--r--nis/nis_call.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/nis/nis_call.c b/nis/nis_call.c
index 92c70e9..da4c52b 100644
--- a/nis/nis_call.c
+++ b/nis/nis_call.c
@@ -575,7 +575,7 @@ static struct nis_server_cache
unsigned int size;
unsigned int server_used;
unsigned int current_ep;
- time_t expires;
+ __time64_t expires;
char name[];
} *nis_server_cache[16];
static time_t nis_cold_start_mtime;
@@ -584,7 +584,7 @@ __libc_lock_define_initialized (static, nis_server_cache_lock)
static directory_obj *
nis_server_cache_search (const_nis_name name, int search_parent,
unsigned int *server_used, unsigned int *current_ep,
- struct timeval *now)
+ struct __timespec64 *now)
{
directory_obj *ret = NULL;
int i;
@@ -642,7 +642,7 @@ nis_server_cache_search (const_nis_name name, int search_parent,
static void
nis_server_cache_add (const_nis_name name, int search_parent,
directory_obj *dir, unsigned int server_used,
- unsigned int current_ep, struct timeval *now)
+ unsigned int current_ep, struct __timespec64 *now)
{
struct nis_server_cache **loc;
struct nis_server_cache *new;
@@ -708,8 +708,7 @@ __nisfind_server (const_nis_name name, int search_parent,
nis_error result = NIS_SUCCESS;
nis_error status;
directory_obj *obj;
- struct timeval now;
- struct timespec ts;
+ struct __timespec64 ts;
unsigned int server_used = ~0;
unsigned int current_ep = ~0;
@@ -719,12 +718,11 @@ __nisfind_server (const_nis_name name, int search_parent,
if (*dir != NULL)
return NIS_SUCCESS;
- __clock_gettime (CLOCK_REALTIME, &ts);
- TIMESPEC_TO_TIMEVAL (&now, &ts);
+ __clock_gettime64 (CLOCK_REALTIME, &ts);
if ((flags & NO_CACHE) == 0)
*dir = nis_server_cache_search (name, search_parent, &server_used,
- &current_ep, &now);
+ &current_ep, &ts);
if (*dir != NULL)
{
unsigned int server_len = (*dir)->do_servers.do_servers_len;
@@ -783,7 +781,7 @@ __nisfind_server (const_nis_name name, int search_parent,
}
if ((flags & NO_CACHE) == 0)
nis_server_cache_add (name, search_parent, obj,
- server_used, current_ep, &now);
+ server_used, current_ep, &ts);
}
else
{