summaryrefslogtreecommitdiff
path: root/ext/socket/rubysocket.h
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-17 11:01:17 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-17 11:01:17 +0000
commitce6db8f286160fbf71c409416bd43c229b874601 (patch)
treee3ecd729b24a4746f8541954584b890404b7ecf0 /ext/socket/rubysocket.h
parentcef6a377fcae99d062b2c7d9e0db2c07719c6975 (diff)
* ext/socket/rubysocket.h (SOCKLEN_MAX): Defined.
* ext/socket/raddrinfo.c (ext/socket/raddrinfo.c): Reject too long Linux abstract socket name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/rubysocket.h')
-rw-r--r--ext/socket/rubysocket.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/socket/rubysocket.h b/ext/socket/rubysocket.h
index 5369f56..1636a38 100644
--- a/ext/socket/rubysocket.h
+++ b/ext/socket/rubysocket.h
@@ -91,6 +91,12 @@
#ifndef HAVE_TYPE_SOCKLEN_T
typedef int socklen_t;
#endif
+
+#define SOCKLEN_MAX \
+ (0 < (((socklen_t)0)-1) ? \
+ ~(socklen_t)0 : \
+ (((((socklen_t)1) << (sizeof(socklen_t) * CHAR_BIT - 2)) - 1) * 2 + 1))
+
#ifndef RSTRING_SOCKLEN
# define RSTRING_SOCKLEN (socklen_t)RSTRING_LENINT
#endif