From a2700b5071e53a78be2f8098765dcca58c2b6ee5 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Thu, 5 Mar 2020 11:42:12 -0500 Subject: *: use gmtime_r, localtime_r exclusively Stop using gmtime() or localtime() everywhere. Signed-off-by: Mark Stapp --- lib/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/log.c') diff --git a/lib/log.c b/lib/log.c index 5240eeaf72..2101e0225c 100644 --- a/lib/log.c +++ b/lib/log.c @@ -220,11 +220,11 @@ size_t quagga_timestamp(int timestamp_precision, char *buf, size_t buflen) /* first, we update the cache if the time has changed */ if (cache.last != clock.tv_sec) { - struct tm *tm; + struct tm tm; cache.last = clock.tv_sec; - tm = localtime(&cache.last); + localtime_r(&cache.last, &tm); cache.len = strftime(cache.buf, sizeof(cache.buf), - "%Y/%m/%d %H:%M:%S", tm); + "%Y/%m/%d %H:%M:%S", &tm); } /* note: it's not worth caching the subsecond part, because chances are that back-to-back calls are not sufficiently close -- cgit v1.2.3