summaryrefslogtreecommitdiff
path: root/ext/socket/unixsocket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-15 22:19:05 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-02-15 22:19:05 +0000
commitcb31e783798438420e33a84a8bfe66acafaa7c4a (patch)
treeabd633cd3da6ebf4155f883b0179866487235998 /ext/socket/unixsocket.c
parent84a525bc4e47c33c07cc135e6e77df1369375042 (diff)
* ext/socket/extconf.rb: test struct sockaddr_un and its member,
sun_len. * ext/socket/sockport.h (INIT_SOCKADDR_UN): new macro defined. * ext/socket/socket.c (sock_s_pack_sockaddr_un): use INIT_SOCKADDR_UN. * ext/socket/unixsocket.c (rsock_init_unixsock): ditto. * ext/socket/raddrinfo.c (init_unix_addrinfo): ditto. (addrinfo_mload): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/unixsocket.c')
-rw-r--r--ext/socket/unixsocket.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 75da9c1..6e4e0fc 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -39,8 +39,7 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
rb_sys_fail("socket(2)");
}
- MEMZERO(&sockaddr, struct sockaddr_un, 1);
- sockaddr.sun_family = AF_UNIX;
+ INIT_SOCKADDR_UN(&sockaddr, sizeof(struct sockaddr_un));
if (sizeof(sockaddr.sun_path) < (size_t)RSTRING_LEN(path)) {
rb_raise(rb_eArgError, "too long unix socket path (%ldbytes given but %dbytes max)",
RSTRING_LEN(path), (int)sizeof(sockaddr.sun_path));