summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-10 15:39:16 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-10 15:39:16 +0000
commitbe25c48638a0ba5d619e28fe67defc8e23078317 (patch)
tree9194a931423e3ff0dd34de8e64a000cc07aa3f2d /ext/socket/socket.c
parent2ee08591190bed1f57a43a5cdd6486e3abfa664f (diff)
* 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.c5
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)