From cdbb8064bd6fad7e6e7306a6cff36ec029271834 Mon Sep 17 00:00:00 2001 From: Asutorufa <16442314+Asutorufa@users.noreply.github.com> Date: Tue, 1 Jul 2025 22:11:13 +0800 Subject: [PATCH] unix: The error should not be overridden by anyToSockaddr otherwise, the length of the data will return as -1 Signed-off-by: Asutorufa <16442314+Asutorufa@users.noreply.github.com> --- unix/syscall_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/syscall_unix.go b/unix/syscall_unix.go index 4e92e5aa40..af778fa665 100644 --- a/unix/syscall_unix.go +++ b/unix/syscall_unix.go @@ -369,7 +369,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from var rsa RawSockaddrAny n, oobn, recvflags, err = recvmsgRaw(fd, iov[:], oob, flags, &rsa) // source address is only specified if the socket is unconnected - if rsa.Addr.Family != AF_UNSPEC { + if err == nil && rsa.Addr.Family != AF_UNSPEC { from, err = anyToSockaddr(fd, &rsa) } return