]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: fix return of local from ctime_r
authorMark Stapp <mjs@labn.net>
Thu, 21 Sep 2023 12:20:49 +0000 (08:20 -0400)
committerMark Stapp <mjs@labn.net>
Thu, 21 Sep 2023 12:20:49 +0000 (08:20 -0400)
Don't return a local - caller needs to pass in a buffer.

Signed-off-by: Mark Stapp <mjs@labn.net>
bgpd/bgp_updgrp.c
bgpd/bgpd.h

index 701c7aba57cfbdb9956e8e3a426d2e0356e3656b..a2006c3508d4d0041114b4abe0727e2527e5feda 100644 (file)
@@ -734,7 +734,8 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
                                       safi2str(updgrp->safi));
        } else {
                vty_out(vty, "Update-group %" PRIu64 ":\n", updgrp->id);
-               vty_out(vty, "  Created: %s", timestamp_string(updgrp->uptime));
+               vty_out(vty, "  Created: %s",
+                       timestamp_string(updgrp->uptime, timebuf));
        }
 
        filter = &updgrp->conf->filter[updgrp->afi][updgrp->safi];
@@ -803,7 +804,7 @@ static int update_group_show_walkcb(struct update_group *updgrp, void *arg)
                        vty_out(vty, "  Update-subgroup %" PRIu64 ":\n",
                                subgrp->id);
                        vty_out(vty, "    Created: %s",
-                               timestamp_string(subgrp->uptime));
+                               timestamp_string(subgrp->uptime, timebuf));
                }
 
                if (subgrp->split_from.update_group_id
index b80e0e787b2c9129189c1e3e9170a526e1041009..ca1411a3b17951e8f86c814993bce9935f848e24 100644 (file)
@@ -2595,10 +2595,9 @@ static inline int peer_group_af_configured(struct peer_group *group)
        return 0;
 }
 
-static inline char *timestamp_string(time_t ts)
+static inline char *timestamp_string(time_t ts, char *timebuf)
 {
        time_t tbuf;
-       char timebuf[32];
 
        tbuf = time(NULL) - (monotime(NULL) - ts);
        return ctime_r(&tbuf, timebuf);