diff options
-rw-r--r-- | bgpd/bgp_dump.c | 14 | ||||
-rw-r--r-- | lib/keychain.c | 6 | ||||
-rw-r--r-- | lib/log.c | 6 |
3 files changed, 13 insertions, 13 deletions
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c index 0a18ae29..b44b57ce 100644 --- a/bgpd/bgp_dump.c +++ b/bgpd/bgp_dump.c @@ -96,21 +96,21 @@ bgp_dump_open_file (struct bgp_dump *bgp_dump) { int ret; time_t clock; - struct tm *tm; + struct tm tm; char fullpath[MAXPATHLEN]; char realpath[MAXPATHLEN]; mode_t oldumask; time (&clock); - tm = localtime (&clock); + localtime_r(&clock, &tm); if (bgp_dump->filename[0] != DIRECTORY_SEP) { sprintf (fullpath, "%s/%s", vty_get_cwd (), bgp_dump->filename); - ret = strftime (realpath, MAXPATHLEN, fullpath, tm); + ret = strftime (realpath, MAXPATHLEN, fullpath, &tm); } else - ret = strftime (realpath, MAXPATHLEN, bgp_dump->filename, tm); + ret = strftime (realpath, MAXPATHLEN, bgp_dump->filename, &tm); if (ret == 0) { @@ -141,7 +141,7 @@ bgp_dump_interval_add (struct bgp_dump *bgp_dump, int interval) { int secs_into_day; time_t t; - struct tm *tm; + struct tm tm; if (interval > 0) { @@ -152,8 +152,8 @@ bgp_dump_interval_add (struct bgp_dump *bgp_dump, int interval) * intervals, dump every interval seconds starting from midnight */ (void) time(&t); - tm = localtime(&t); - secs_into_day = tm->tm_sec + 60*tm->tm_min + 60*60*tm->tm_hour; + localtime_r(&t, &tm); + secs_into_day = tm.tm_sec + 60*tm.tm_min + 60*60*tm.tm_hour; interval = interval - secs_into_day % interval; /* always > 0 */ } bgp_dump->t_interval = thread_add_timer (master, bgp_dump_interval_func, 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; } @@ -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 |