diff options
| author | David Lamparter <equinox@diac24.net> | 2021-04-10 21:36:50 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2021-06-18 21:05:21 +0200 |
| commit | f6caaa6524342ba734ba8266b5f808d8d1c1e80b (patch) | |
| tree | 9a9eeb6b936a807008b9aa80d3dc93f35c9da813 /lib/zlog_targets.c | |
| parent | e3daa82c1897c289384988add6932f74b0de4e9e (diff) | |
lib: use fbuf for zlog_msg_ts()
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/zlog_targets.c')
| -rw-r--r-- | lib/zlog_targets.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/zlog_targets.c b/lib/zlog_targets.c index 7799fbfda7..80cb246b7a 100644 --- a/lib/zlog_targets.c +++ b/lib/zlog_targets.c @@ -82,10 +82,16 @@ void zlog_fd(struct zlog_target *zt, struct zlog_msg *msgs[], size_t nmsgs) iov[iovpos].iov_base = ts_pos; if (iovpos > 0) *ts_pos++ = '\n'; - ts_pos += zlog_msg_ts(msg, ts_pos, - sizeof(ts_buf) - 1 - - (ts_pos - ts_buf), - ZLOG_TS_LEGACY | zte->ts_subsec); + + struct fbuf fbuf = { + .buf = ts_buf, + .pos = ts_pos, + .len = sizeof(ts_buf), + }; + zlog_msg_ts(msg, &fbuf, + ZLOG_TS_LEGACY | zte->ts_subsec); + ts_pos = fbuf.pos; + *ts_pos++ = ' '; iov[iovpos].iov_len = ts_pos - (char *)iov[iovpos].iov_base; |
