summaryrefslogtreecommitdiffstats
path: root/ripngd
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-03-05 17:42:12 +0100
committerMark Stapp <mjs@voltanet.io>2020-03-05 19:26:16 +0100
commita2700b5071e53a78be2f8098765dcca58c2b6ee5 (patch)
treee32654991ac297bd3917401ae429ee54da385e5e /ripngd
parentMerge pull request #5890 from mjstapp/zapi_allow_label_num (diff)
downloadfrr-a2700b5071e53a78be2f8098765dcca58c2b6ee5.tar.xz
frr-a2700b5071e53a78be2f8098765dcca58c2b6ee5.zip
*: use gmtime_r, localtime_r exclusively
Stop using gmtime() or localtime() everywhere. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'ripngd')
-rw-r--r--ripngd/ripng_peer.c16
-rw-r--r--ripngd/ripngd.c10
2 files changed, 13 insertions, 13 deletions
diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c
index 109524e21..c038bfccf 100644
--- a/ripngd/ripng_peer.c
+++ b/ripngd/ripng_peer.c
@@ -141,7 +141,7 @@ void ripng_peer_bad_packet(struct ripng *ripng, struct sockaddr_in6 *from)
static char *ripng_peer_uptime(struct ripng_peer *peer, char *buf, size_t len)
{
time_t uptime;
- struct tm *tm;
+ struct tm tm;
/* If there is no connection has been done before print `never'. */
if (peer->uptime == 0) {
@@ -152,17 +152,17 @@ static char *ripng_peer_uptime(struct ripng_peer *peer, char *buf, size_t len)
/* Get current time. */
uptime = time(NULL);
uptime -= peer->uptime;
- tm = gmtime(&uptime);
+ gmtime_r(&uptime, &tm);
if (uptime < ONE_DAY_SECOND)
- snprintf(buf, len, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min,
- tm->tm_sec);
+ snprintf(buf, len, "%02d:%02d:%02d", tm.tm_hour, tm.tm_min,
+ tm.tm_sec);
else if (uptime < ONE_WEEK_SECOND)
- snprintf(buf, len, "%dd%02dh%02dm", tm->tm_yday, tm->tm_hour,
- tm->tm_min);
+ snprintf(buf, len, "%dd%02dh%02dm", tm.tm_yday, tm.tm_hour,
+ tm.tm_min);
else
- snprintf(buf, len, "%02dw%dd%02dh", tm->tm_yday / 7,
- tm->tm_yday - ((tm->tm_yday / 7) * 7), tm->tm_hour);
+ snprintf(buf, len, "%02dw%dd%02dh", tm.tm_yday / 7,
+ tm.tm_yday - ((tm.tm_yday / 7) * 7), tm.tm_hour);
return buf;
}
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index f8d7dc968..b583df4de 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -1991,20 +1991,20 @@ void ripng_event(struct ripng *ripng, enum ripng_event event, int sock)
static void ripng_vty_out_uptime(struct vty *vty, struct ripng_info *rinfo)
{
time_t clock;
- struct tm *tm;
+ struct tm tm;
#define TIME_BUF 25
char timebuf[TIME_BUF];
struct thread *thread;
if ((thread = rinfo->t_timeout) != NULL) {
clock = thread_timer_remain_second(thread);
- tm = gmtime(&clock);
- strftime(timebuf, TIME_BUF, "%M:%S", tm);
+ gmtime_r(&clock, &tm);
+ strftime(timebuf, TIME_BUF, "%M:%S", &tm);
vty_out(vty, "%5s", timebuf);
} else if ((thread = rinfo->t_garbage_collect) != NULL) {
clock = thread_timer_remain_second(thread);
- tm = gmtime(&clock);
- strftime(timebuf, TIME_BUF, "%M:%S", tm);
+ gmtime_r(&clock, &tm);
+ strftime(timebuf, TIME_BUF, "%M:%S", &tm);
vty_out(vty, "%5s", timebuf);
}
}