* ext/socket/socket.c (sock_gethostname): use HOST_NAME_MAX.
* ext/socket/raddrinfo.c (make_ipaddr): local variable renamed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2ee0859119
commit
be25c48638
@ -1,3 +1,9 @@
|
|||||||
|
Wed Feb 11 00:38:16 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* ext/socket/socket.c (sock_gethostname): use HOST_NAME_MAX.
|
||||||
|
|
||||||
|
* ext/socket/raddrinfo.c (make_ipaddr): local variable renamed.
|
||||||
|
|
||||||
Tue Feb 10 23:44:53 2009 Tanaka Akira <akr@fsij.org>
|
Tue Feb 10 23:44:53 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* ext/socket/init.c (struct recvfrom_arg): use struct
|
* ext/socket/init.c (struct recvfrom_arg): use struct
|
||||||
|
@ -193,10 +193,10 @@ make_ipaddr0(struct sockaddr *addr, char *buf, size_t len)
|
|||||||
VALUE
|
VALUE
|
||||||
make_ipaddr(struct sockaddr *addr)
|
make_ipaddr(struct sockaddr *addr)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char hbuf[1024];
|
||||||
|
|
||||||
make_ipaddr0(addr, buf, sizeof(buf));
|
make_ipaddr0(addr, hbuf, sizeof(hbuf));
|
||||||
return rb_str_new2(buf);
|
return rb_str_new2(hbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -826,7 +826,10 @@ sock_sysaccept(VALUE sock)
|
|||||||
static VALUE
|
static VALUE
|
||||||
sock_gethostname(VALUE obj)
|
sock_gethostname(VALUE obj)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
#ifndef HOST_NAME_MAX
|
||||||
|
# define HOST_NAME_MAX 1024
|
||||||
|
#endif
|
||||||
|
char buf[HOST_NAME_MAX+1];
|
||||||
|
|
||||||
rb_secure(3);
|
rb_secure(3);
|
||||||
if (gethostname(buf, (int)sizeof buf - 1) < 0)
|
if (gethostname(buf, (int)sizeof buf - 1) < 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user