summaryrefslogtreecommitdiff
path: root/ext/socket/basicsocket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-09 11:19:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-09 11:19:57 +0000
commit8977fe1e3617cff23c01db396a0617b6ca5da56e (patch)
tree84f25e152b70dfebb53cf79d4a7deec7e86a087f /ext/socket/basicsocket.c
parenta9a17a5a44836d90403659a371e2f9e0377445f8 (diff)
* ext/socket/basicsocket.c (bsock_getsockname): use sockaddr_storage.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/basicsocket.c')
-rw-r--r--ext/socket/basicsocket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c
index fdd2ce7..f6fb9f2 100644
--- a/ext/socket/basicsocket.c
+++ b/ext/socket/basicsocket.c
@@ -326,14 +326,14 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname)
static VALUE
bsock_getsockname(VALUE sock)
{
- char buf[1024];
+ struct sockaddr_storage buf;
socklen_t len = sizeof buf;
rb_io_t *fptr;
GetOpenFile(sock, fptr);
- if (getsockname(fptr->fd, (struct sockaddr*)buf, &len) < 0)
+ if (getsockname(fptr->fd, (struct sockaddr*)&buf, &len) < 0)
rb_sys_fail("getsockname(2)");
- return rb_str_new(buf, len);
+ return rb_str_new((char*)&buf, len);
}
/*