diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-10 15:39:16 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-10 15:39:16 +0000 |
commit | be25c48638a0ba5d619e28fe67defc8e23078317 (patch) | |
tree | 9194a931423e3ff0dd34de8e64a000cc07aa3f2d /ext/socket/socket.c | |
parent | 2ee08591190bed1f57a43a5cdd6486e3abfa664f (diff) | |
download | ruby-be25c48638a0ba5d619e28fe67defc8e23078317.tar.gz |
* 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
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c index abce61307a..33b47451fd 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -826,7 +826,10 @@ sock_sysaccept(VALUE sock) static VALUE 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); if (gethostname(buf, (int)sizeof buf - 1) < 0) |