summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-26 14:34:20 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-26 14:34:20 +0000
commit7371736e49bcb7066651139654f91f0e0cb9ec5a (patch)
tree83f47efef01ca1fa7faf3641ecc3e489a950c521 /ext/socket/socket.c
parentb0b460925cf990ebd368f19816877657ca38f630 (diff)
* ext/socket/socket.c (sockaddr_len): return the shortest length for
unknown socket address. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 1ddaea9..3254894 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -1512,7 +1512,7 @@ sockaddr_len(struct sockaddr *addr)
#endif
default:
- return (socklen_t)sizeof(struct sockaddr_in);
+ return (socklen_t)(offsetof(struct sockaddr, sa_family) + sizeof(addr->sa_family));
}
}