]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: fix live log fields for crashlog
authorDavid Lamparter <equinox@opensourcerouting.org>
Mon, 7 Mar 2022 14:03:53 +0000 (15:03 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Mon, 7 Mar 2022 17:03:13 +0000 (18:03 +0100)
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>
lib/zlog_live.c

index fbe0e5ee494fe68f7ff29f777884066909a8a265..eeedf5c4258a1f73ffb3cb6baf0c6e2ea3178873 100644 (file)
@@ -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);