]> git.puffer.fish Git - mirror/frr.git/commit
lib: fix possible assert() fail in zlog_fd()
authorDavid Lamparter <equinox@diac24.net>
Sat, 10 Apr 2021 19:02:06 +0000 (21:02 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Wed, 21 Apr 2021 14:25:33 +0000 (16:25 +0200)
commitdb2baed166581081db692fab0214752dbb121ed3
tree67083421d6ac85080aa010ca9ef9ddf9cfc63be2
parentbf6005d5f4f893817723e26b844831c22532f2f1
lib: fix possible assert() fail in zlog_fd()

If the last message in a batched logging operation isn't printed due to
priority, this skips the code that flushes prepared messages through
writev() and can trigger the assert() at the end of zlog_fd().

Since any logmsg above info priority triggers a buffer flush, running
into this situation requires a log file target configured for info
priority, at least 1 message of info priority buffered, a debug message
buffered after that, and then a buffer flush (explicit or due to buffer
full).

I haven't seen this chain of events happen in the wild, but it needs
fixing anyway.

Signed-off-by: David Lamparter <equinox@diac24.net>
lib/zlog_targets.c