mirror of
https://github.com/golang/go
synced 2024-11-12 08:50:22 -07:00
syscall: Correct length of GNU/Linux abstract Unix domain sockaddr.
R=rsc, iant2 CC=golang-dev https://golang.org/cl/3974044
This commit is contained in:
parent
fa9befd777
commit
2862d003cb
@ -253,12 +253,15 @@ func (sa *SockaddrUnix) sockaddr() (uintptr, _Socklen, int) {
|
||||
for i := 0; i < n; i++ {
|
||||
sa.raw.Path[i] = int8(name[i])
|
||||
}
|
||||
// length is family (uint16), name, NUL.
|
||||
sl := 2 + _Socklen(n) + 1
|
||||
if sa.raw.Path[0] == '@' {
|
||||
sa.raw.Path[0] = 0
|
||||
// Don't count trailing NUL for abstract address.
|
||||
sl--
|
||||
}
|
||||
|
||||
// length is family (uint16), name, NUL.
|
||||
return uintptr(unsafe.Pointer(&sa.raw)), 2 + _Socklen(n) + 1, 0
|
||||
return uintptr(unsafe.Pointer(&sa.raw)), sl, 0
|
||||
}
|
||||
|
||||
type SockaddrLinklayer struct {
|
||||
|
Loading…
Reference in New Issue
Block a user