1
0
mirror of https://github.com/golang/go synced 2024-11-20 11:04:56 -07:00

fix abstract unix domain sockets

R=rsc
DELTA=5  (3 added, 0 deleted, 2 changed)
OCL=28845
CL=28849
This commit is contained in:
Rob Pike 2009-05-14 15:20:30 -07:00
parent 05851636f3
commit 80b5482ab2
3 changed files with 5 additions and 2 deletions

View File

@ -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;
}

View File

@ -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:

View File

@ -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