Commit 80b5482a authored by Rob Pike's avatar Rob Pike

fix abstract unix domain sockets

R=rsc
DELTA=5  (3 added, 0 deleted, 2 changed)
OCL=28845
CL=28849
parent 05851636
......@@ -95,6 +95,7 @@ func unixToSockaddr(name string) (sa1 *syscall.Sockaddr, err os.Error) {
if sa.Path[0] == '@' {
sa.Path[0] = 0;
}
sa.Length = 1 + int64(n) + 1; // family, name, \0
return (*syscall.Sockaddr)(unsafe.Pointer(sa)), nil;
}
......
......@@ -19,7 +19,8 @@ var SocketDisableIPv6 bool
func saLen(s *Sockaddr) int64 {
switch s.Family {
case AF_UNIX:
return SizeofSockaddrUnix;
sa := (*SockaddrUnix)(unsafe.Pointer(s));
return sa.Length;
case AF_INET:
return SizeofSockaddrInet4;
case AF_INET6:
......
......@@ -166,7 +166,8 @@ const (
type SockaddrUnix struct {
Family uint16;
Path [108]byte
Path [108]byte;
Length int64; // Not part of the kernel structure; used internally
}
const SizeofSockaddrUnix = 110
......
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