]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pathd: don't use localtime
authorMark Stapp <mjs.ietf@gmail.com>
Tue, 20 Jul 2021 12:52:33 +0000 (08:52 -0400)
committermergify-bot <noreply@mergify.io>
Fri, 23 Jul 2021 09:31:32 +0000 (09:31 +0000)
Use localtime_r() instead of localtime() in pathd.

Signed-off-by: Mark Stapp <mjs.ietf@gmail.com>
(cherry picked from commit abfafdece24a0e12e21ee65903dde1cebc0c810e)

pathd/path_pcep_cli.c

index 2e4e331ad970f072c001c6d0d654e04c6d2c15a2..a911210ab4b154d23181c50f346c5f3ca56cc27e 100644 (file)
@@ -505,7 +505,7 @@ static int path_pcep_cli_show_srte_pcep_counters(struct vty *vty)
 {
        int i, j, row;
        time_t diff_time;
-       struct tm *tm_info;
+       struct tm tm_info;
        char tm_buffer[26];
        struct counters_group *group;
        struct counters_subgroup *subgroup;
@@ -522,8 +522,8 @@ static int path_pcep_cli_show_srte_pcep_counters(struct vty *vty)
        }
 
        diff_time = time(NULL) - group->start_time;
-       tm_info = localtime(&group->start_time);
-       strftime(tm_buffer, sizeof(tm_buffer), "%Y-%m-%d %H:%M:%S", tm_info);
+       localtime_r(&group->start_time, &tm_info);
+       strftime(tm_buffer, sizeof(tm_buffer), "%Y-%m-%d %H:%M:%S", &tm_info);
 
        vty_out(vty, "PCEP counters since %s (%uh %um %us):\n", tm_buffer,
                (uint32_t)(diff_time / 3600), (uint32_t)((diff_time / 60) % 60),