summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-03-07 15:03:53 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2022-03-07 18:03:13 +0100
commit1609a9d6360638103e2a1be3f97e8748792840c4 (patch)
tree6de19917c6745c4400260d2f088afc86bec8abbf /lib
parentlib: fix log target removal when singlethreaded (diff)
downloadfrr-1609a9d6360638103e2a1be3f97e8748792840c4.tar.xz
frr-1609a9d6360638103e2a1be3f97e8748792840c4.zip
lib: fix live log fields for crashlog
The timestamps used for the live log are wallclock, not monotonic. Also some fields were left uninitialized. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/zlog_live.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/zlog_live.c b/lib/zlog_live.c
index fbe0e5ee4..eeedf5c42 100644
--- a/lib/zlog_live.c
+++ b/lib/zlog_live.c
@@ -134,7 +134,7 @@ static void zlog_live_sigsafe(struct zlog_target *zt, const char *text,
size_t len)
{
struct zlt_live *zte = container_of(zt, struct zlt_live, zt);
- struct zlog_live_hdr hdr[1];
+ struct zlog_live_hdr hdr[1] = {};
struct iovec iovs[2], *iov = iovs;
struct timespec ts;
int fd;
@@ -143,14 +143,12 @@ static void zlog_live_sigsafe(struct zlog_target *zt, const char *text,
if (fd < 0)
return;
- clock_gettime(CLOCK_MONOTONIC, &ts);
+ clock_gettime(CLOCK_REALTIME, &ts);
hdr->ts_sec = ts.tv_sec;
hdr->ts_nsec = ts.tv_nsec;
hdr->prio = LOG_CRIT;
- hdr->flags = 0;
hdr->textlen = len;
- hdr->n_argpos = 0;
iov->iov_base = (char *)hdr;
iov->iov_len = sizeof(hdr);