summaryrefslogtreecommitdiff
path: root/lib/bfd.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2020-03-05 17:38:13 -0500
committerGitHub <noreply@github.com>2020-03-05 17:38:13 -0500
commit5d2724ec2564b648bf93dc7b164a1398cde3c214 (patch)
tree92976c12468fcce1c582152d059e4bb4b0514e5d /lib/bfd.c
parent498897d8d837f2abee51a0064ee45c639340c5bb (diff)
parenta2700b5071e53a78be2f8098765dcca58c2b6ee5 (diff)
Merge pull request #5916 from mjstapp/fix_gmtime
*: use gmtime_r exclusively
Diffstat (limited to 'lib/bfd.c')
-rw-r--r--lib/bfd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/bfd.c b/lib/bfd.c
index cf65d6d4ed..5f2d2f0eda 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -328,7 +328,7 @@ static void bfd_last_update(time_t last_update, char *buf, size_t len)
{
time_t curr;
time_t diff;
- struct tm *tm;
+ struct tm tm;
struct timeval tv;
/* If no BFD satatus update has ever been received, print `never'. */
@@ -341,10 +341,10 @@ static void bfd_last_update(time_t last_update, char *buf, size_t len)
monotime(&tv);
curr = tv.tv_sec;
diff = curr - last_update;
- tm = gmtime(&diff);
+ gmtime_r(&diff, &tm);
- snprintf(buf, len, "%d:%02d:%02d:%02d", tm->tm_yday, tm->tm_hour,
- tm->tm_min, tm->tm_sec);
+ snprintf(buf, len, "%d:%02d:%02d:%02d", tm.tm_yday, tm.tm_hour,
+ tm.tm_min, tm.tm_sec);
}
/*