summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog4
-rw-r--r--ext/socket/basicsocket.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c211d6ef49..b75aa85365 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Feb 9 20:19:36 2009 Tanaka Akira <akr@fsij.org>
+
+ * ext/socket/basicsocket.c (bsock_getsockname): use sockaddr_storage.
+
Mon Feb 9 20:11:55 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/win32ole/win32ole.c (load_conv_function51932): fixed for the
diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c
index fdd2ce7221..f6fb9f264a 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);
}
/*