unix: fix sendmsgN return value for empty iovecs and non-empty oob Don't shadow the empty var when determining whether to send a single byte when iovecs are empty but oob is non-empty. This will lead to the n value correctly being reset to 0 before return. No test because it's not possible to trigger this case on all platforms, e.g. darwin where sendmsg with empty buf and non-empty oob returns EINVAL. This was introduced by CL 412497 and CL 419396. Updates golang/go#52885 Change-Id: Iafc5a4b22e10b396ba5f7d4f2ac1c50df195a125 Reviewed-on: https://go-review.googlesource.com/c/sys/+/419914 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
diff --git a/unix/syscall_aix.go b/unix/syscall_aix.go index e2a30e8..2db1b51 100644 --- a/unix/syscall_aix.go +++ b/unix/syscall_aix.go
@@ -253,7 +253,7 @@ var empty bool if len(oob) > 0 { // send at least one normal byte - empty := emptyIovecs(iov) + empty = emptyIovecs(iov) if empty { var iova [1]Iovec iova[0].Base = &dummy
diff --git a/unix/syscall_bsd.go b/unix/syscall_bsd.go index c437fc5..eda4267 100644 --- a/unix/syscall_bsd.go +++ b/unix/syscall_bsd.go
@@ -363,7 +363,7 @@ var empty bool if len(oob) > 0 { // send at least one normal byte - empty := emptyIovecs(iov) + empty = emptyIovecs(iov) if empty { var iova [1]Iovec iova[0].Base = &dummy
diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go index 5e4a94f..ecb0f27 100644 --- a/unix/syscall_linux.go +++ b/unix/syscall_linux.go
@@ -1541,7 +1541,7 @@ var dummy byte var empty bool if len(oob) > 0 { - empty := emptyIovecs(iov) + empty = emptyIovecs(iov) if empty { var sockType int sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)