From: Mark Stapp Date: Thu, 21 Sep 2023 12:20:49 +0000 (-0400) Subject: bgpd: fix return of local from ctime_r X-Git-Tag: base_9.1~49^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=8f338b16ed8ca35073d2d34d2747c87466ce65ca;p=matthieu%2Ffrr.git bgpd: fix return of local from ctime_r Don't return a local - caller needs to pass in a buffer. Signed-off-by: Mark Stapp --- diff --git a/bgpd/bgp_updgrp.c b/bgpd/bgp_updgrp.c index 701c7aba57..a2006c3508 100644 --- a/bgpd/bgp_updgrp.c +++ b/bgpd/bgp_updgrp.c @@ -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 diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index b80e0e787b..ca1411a3b1 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -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);