summaryrefslogtreecommitdiffstats
path: root/lib/log.c
diff options
context:
space:
mode:
authorpaulo <paul@bayleaf.org.uk>2010-02-05 12:05:47 +0000
committerpaulo <paul@bayleaf.org.uk>2010-02-05 12:05:47 +0000
commit9cf5d831389086c2060a2bfbe3f9ac79f488623f (patch)
tree81d3484cefac2dc9060c013cd5955f5647d39613 /lib/log.c
parentc751ea18005633ceac54cf7415147e04adb19cb5 (diff)
downloadquagga-9cf5d831389086c2060a2bfbe3f9ac79f488623f.tar.bz2
quagga-9cf5d831389086c2060a2bfbe3f9ac79f488623f.tar.xz
Relace localtime with localtime_r to be thread safe.
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c6
1 files changed, 3 insertions, 3 deletions
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