Commit 2862d003 authored by Ian Lance Taylor's avatar Ian Lance Taylor

syscall: Correct length of GNU/Linux abstract Unix domain sockaddr.

R=rsc, iant2
CC=golang-dev
https://golang.org/cl/3974044
parent fa9befd7
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment