From 2eda953a2af82d37f2b0b4bda4dfa639b8dc862b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Sat, 5 Mar 2022 19:43:05 +0100 Subject: [PATCH] lib: make live log sockets non-blocking This was the intent here to begin with, not sure where I managed to forget this along the way... Signed-off-by: David Lamparter --- lib/zlog_live.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/zlog_live.c b/lib/zlog_live.c index eeedf5c425..7abf1a801a 100644 --- a/lib/zlog_live.c +++ b/lib/zlog_live.c @@ -22,6 +22,7 @@ #include "frrcu.h" #include "zlog.h" #include "printfrr.h" +#include "network.h" DEFINE_MTYPE_STATIC(LOG, LOG_LIVE, "log vtysh live target"); @@ -109,6 +110,8 @@ static void zlog_live(struct zlog_target *zt, struct zlog_msg *msgs[], for (size_t msgpos = 0; msgpos < msgtotal; msgpos += sent) { sent = sendmmsg(fd, mmhs + msgpos, msgtotal - msgpos, 0); + if (sent <= 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) + break; if (sent <= 0) goto out_err; } @@ -195,6 +198,7 @@ void zlog_live_open(struct zlog_live_cfg *cfg, int prio_min, int *other_fd) zte = container_of(zt, struct zlt_live, zt); cfg->target = zte; + set_nonblocking(sockets[0]); zte->fd = sockets[0]; zte->zt.prio_min = prio_min; zte->zt.logfn = zlog_live; -- 2.39.5