debuginfod/debuginfod-client.c: use long for cache time configurations
authorAlexander Kanavin <alex@linutronix.de>
Thu, 9 Dec 2021 09:51:23 +0000 (10:51 +0100)
committerMark Wielaard <mark@klomp.org>
Wed, 15 Dec 2021 23:49:52 +0000 (00:49 +0100)
time_t is platform dependent and some of architectures e.g.
x32, riscv32, arc use 64bit time_t even while they are 32bit
architectures, therefore directly using integer printf formats will not
work portably.

Use a plain long everywhere as the intervals are small enough
that it will not be problematic.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
debuginfod/ChangeLog
debuginfod/debuginfod-client.c

index 2642ef5..dfb5d42 100644 (file)
@@ -1,3 +1,10 @@
+2021-12-09  Alexander Kanavin <alex@linutronix.de>
+
+       * debuginfod-client.c (cache_clean_default_interval_s): Change type to
+       long from time_t.
+       (cache_miss_default_s): Likewise.
+       (cache_default_max_unused_age_s): Likewise.
+
 2021-12-09  Mark Wielaard  <mark@klomp.org>
 
        * debuginfod.cxx (database_stats_report): Don't format clog
index 9bf97bf..024b095 100644 (file)
@@ -135,17 +135,17 @@ struct debuginfod_client
    how frequently the cache should be cleaned. The file's st_mtime represents
    the time of last cleaning.  */
 static const char *cache_clean_interval_filename = "cache_clean_interval_s";
-static const time_t cache_clean_default_interval_s = 86400; /* 1 day */
+static const long cache_clean_default_interval_s = 86400; /* 1 day */
 
 /* The cache_miss_default_s within the debuginfod cache specifies how
    frequently the 000-permision file should be released.*/
-static const time_t cache_miss_default_s = 600; /* 10 min */
+static const long cache_miss_default_s = 600; /* 10 min */
 static const char *cache_miss_filename = "cache_miss_s";
 
 /* The cache_max_unused_age_s file within the debuginfod cache specifies the
    the maximum time since last access that a file will remain in the cache.  */
 static const char *cache_max_unused_age_filename = "max_unused_age_s";
-static const time_t cache_default_max_unused_age_s = 604800; /* 1 week */
+static const long cache_default_max_unused_age_s = 604800; /* 1 week */
 
 /* Location of the cache of files downloaded from debuginfods.
    The default parent directory is $HOME, or '/' if $HOME doesn't exist.  */