mirror of
https://github.com/golang/go
synced 2024-11-25 22:17:58 -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:
parent
05851636f3
commit
80b5482ab2
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user