[2/3] nscd: Use 64 bit time_t on libc nscd routines (BZ# 29402)

Message ID 20221026190425.2939456-3-adhemerval.zanella@linaro.org
State New
Headers
Series Fixing missing 64 bit time_t usages |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Adhemerval Zanella Netto Oct. 26, 2022, 7:04 p.m. UTC
  Although the nscd module is built with 64 bit time_t, the routines
linked direct to libc.so need to use the internal symbols.
---
 nscd/nscd.h          | 2 +-
 nscd/nscd_gethst_r.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

DJ Delorie Oct. 26, 2022, 9:42 p.m. UTC | #1
Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> writes:
> -  time_t mtime;
> +  __time64_t mtime;

Wait... does this mean that the format of the nscd cache changed at some
point and we didn't flag it as an externally visible ABI change?
  
Adhemerval Zanella Netto Oct. 27, 2022, 12:31 p.m. UTC | #2
On 26/10/22 18:42, DJ Delorie wrote:
> Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> writes:
>> -  time_t mtime;
>> +  __time64_t mtime;
> 
> Wait... does this mean that the format of the nscd cache changed at some
> point and we didn't flag it as an externally visible ABI change?
> 

It seems so, not sure how to handle it. We will need to eventually do it
anyway (we have a similar issue with the utmp, wtmp).
  
Andreas Schwab Oct. 27, 2022, 12:48 p.m. UTC | #3
On Okt 26 2022, DJ Delorie via Libc-alpha wrote:

> Wait... does this mean that the format of the nscd cache changed at some
> point and we didn't flag it as an externally visible ABI change?

nscd_time_t has always been a 64-bit type.
  

Patch

diff --git a/nscd/nscd.h b/nscd/nscd.h
index 368091aef8..f15321585b 100644
--- a/nscd/nscd.h
+++ b/nscd/nscd.h
@@ -65,7 +65,7 @@  typedef enum
 struct traced_file
 {
   /* Tracks the last modified time of the traced file.  */
-  time_t mtime;
+  __time64_t mtime;
   /* Support multiple registered files per database.  */
   struct traced_file *next;
   int call_res_init;
diff --git a/nscd/nscd_gethst_r.c b/nscd/nscd_gethst_r.c
index 31d13580a1..5958f181db 100644
--- a/nscd/nscd_gethst_r.c
+++ b/nscd/nscd_gethst_r.c
@@ -112,7 +112,7 @@  __nscd_get_nl_timestamp (void)
   if (map == NULL
       || (map != NO_MAPPING
 	  && map->head->nscd_certainly_running == 0
-	  && map->head->timestamp + MAPPING_TIMEOUT < time_now ()))
+	  && map->head->timestamp + MAPPING_TIMEOUT < time64_now ()))
     map = __nscd_get_mapping (GETFDHST, "hosts", &__hst_map_handle.mapped);
 
   if (map == NO_MAPPING)