mirror of
https://github.com/golang/sys.git
synced 2026-02-08 03:36:03 +03:00
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>
This commit is contained in:
committed by
Gopher Robot
parent
66a0560e4e
commit
a90be44021
@@ -253,7 +253,7 @@ func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Sockle
|
||||
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
|
||||
|
||||
@@ -363,7 +363,7 @@ func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Sockle
|
||||
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
|
||||
|
||||
@@ -1541,7 +1541,7 @@ func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Sockle
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user