From 5ef0fc44a9a334f6b433a2c795d82b89dd9f1133 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 18 May 2026 13:22:42 +1000 Subject: tap: Report accept() errors Currently, if accept4() fails in tap_listen_handler(), we carry on as if it succeeded. Something will probably fail shortly down the line, but that's needlessly confusing. Report an error instead. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- tap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tap.c b/tap.c index e0d3ee5..b318327 100644 --- a/tap.c +++ b/tap.c @@ -1493,6 +1493,10 @@ void tap_listen_handler(struct ctx *c, uint32_t events) } c->fd_tap = accept4(c->fd_tap_listen, NULL, NULL, SOCK_CLOEXEC); + if (c->fd_tap < 0) { + warn_perror("Error accepting tap client"); + return; + } if (!getsockopt(c->fd_tap, SOL_SOCKET, SO_PEERCRED, &ucred, &len)) info("accepted connection from PID %i", ucred.pid); -- cgit v1.2.3