summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/keychain.c6
-rw-r--r--lib/log.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/keychain.c b/lib/keychain.c
index 6719cebf..41c463f9 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -865,12 +865,12 @@ static struct cmd_node keychain_key_node =
static int
keychain_strftime (char *buf, int bufsiz, time_t *time)
{
- struct tm *tm;
+ struct tm tm;
size_t len;
- tm = localtime (time);
+ localtime_r(time, &tm);
- len = strftime (buf, bufsiz, "%T %b %d %Y", tm);
+ len = strftime (buf, bufsiz, "%T %b %d %Y", &tm);
return len;
}
diff --git a/lib/log.c b/lib/log.c
index 12b76c14..2d636599 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -117,11 +117,11 @@ uquagga_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 together