Skip to content

Commit cdbb806

Browse files
committed
unix: The error should not be overridden by anyToSockaddr
otherwise, the length of the data will return as -1 Signed-off-by: Asutorufa <[email protected]>
1 parent 751c3c6 commit cdbb806

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

unix/syscall_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
369369
var rsa RawSockaddrAny
370370
n, oobn, recvflags, err = recvmsgRaw(fd, iov[:], oob, flags, &rsa)
371371
// source address is only specified if the socket is unconnected
372-
if rsa.Addr.Family != AF_UNSPEC {
372+
if err == nil && rsa.Addr.Family != AF_UNSPEC {
373373
from, err = anyToSockaddr(fd, &rsa)
374374
}
375375
return

0 commit comments

Comments
 (0)