From 33b192c845b5cb22d6a3aae86f10cfbc3cf8d875 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 29 Jul 2025 01:06:40 +0200 Subject: [PATCH] unix: fix udp sendmmsg fallback path (#4849) Fix a logic bug in the fallback code for platforms that don't have a sendmmsg-like system call. It only sent at most one packet, even when there were more available, and that was observable through a failing test on such systems. Fixes: https://github.com/libuv/libuv/issues/4848 --- src/unix/udp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/unix/udp.c b/src/unix/udp.c index 9f58edfe3..75cac4cdf 100644 --- a/src/unix/udp.c +++ b/src/unix/udp.c @@ -661,10 +661,10 @@ int uv__udp_try_send(uv_udp_t* handle, } err = uv__udp_sendmsg1(handle->io_watcher.fd, bufs, nbufs, addr); - if (err > 0) - return uv__count_bufs(bufs, nbufs); + if (err) + return err; - return err; + return uv__count_bufs(bufs, nbufs); } @@ -1295,7 +1295,7 @@ static int uv__udp_sendmsg1(int fd, /* UDP sockets don't EOF so we don't have to handle r=0 specially, * that only happens when the input was a zero-sized buffer. */ - return 1; + return 0; }