mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
a9a17a5a44
commit
8977fe1e36
2 changed files with 7 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue