summaryrefslogtreecommitdiff
path: root/ext/socket
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-18 12:31:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-01-18 12:31:57 +0000
commit57b2190d55d9719552556484a1923e28e94de1ed (patch)
treef12639f95a8ba0e307166d39c86a083be4a71f05 /ext/socket
parent24a52978d4e2fe59cfa57c216c1118dce5f81640 (diff)
* ext/socket/option.c: IP_MULTICAST_LOOP and IP_MULTICAST_TTL socket
option takes a byte on OpenBSD. Fixed by Jeremy Evans. [ruby-core:59496] [Bug #9350] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket')
-rw-r--r--ext/socket/option.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/socket/option.c b/ext/socket/option.c
index 3e32230..28bdc07 100644
--- a/ext/socket/option.c
+++ b/ext/socket/option.c
@@ -357,7 +357,7 @@ static VALUE
sockopt_s_ipv4_multicast_loop(VALUE klass, VALUE value)
{
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_LOOP)
-# ifdef __NetBSD__
+# if defined(__NetBSD__) || defined(__OpenBSD__)
unsigned char i = NUM2CHR(rb_to_int(value));
# else
int i = NUM2INT(rb_to_int(value));
@@ -387,7 +387,7 @@ sockopt_ipv4_multicast_loop(VALUE self)
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_LOOP)
if (family == AF_INET && level == IPPROTO_IP && optname == IP_MULTICAST_LOOP) {
-# ifdef __NetBSD__
+# if defined(__NetBSD__) || defined(__OpenBSD__)
return sockopt_byte(self);
# else
return sockopt_int(self);
@@ -398,7 +398,7 @@ sockopt_ipv4_multicast_loop(VALUE self)
UNREACHABLE;
}
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__OpenBSD__)
# define inspect_ipv4_multicast_loop(a,b,c,d) inspect_byte(a,b,c,d)
#else
# define inspect_ipv4_multicast_loop(a,b,c,d) inspect_int(a,b,c,d)
@@ -420,7 +420,7 @@ static VALUE
sockopt_s_ipv4_multicast_ttl(VALUE klass, VALUE value)
{
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_TTL)
-# ifdef __NetBSD__
+# if defined(__NetBSD__) || defined(__OpenBSD__)
unsigned char i = NUM2CHR(rb_to_int(value));
# else
int i = NUM2INT(rb_to_int(value));
@@ -450,7 +450,7 @@ sockopt_ipv4_multicast_ttl(VALUE self)
#if defined(IPPROTO_IP) && defined(IP_MULTICAST_TTL)
if (family == AF_INET && level == IPPROTO_IP && optname == IP_MULTICAST_TTL) {
-# ifdef __NetBSD__
+# if defined(__NetBSD__) || defined(__OpenBSD__)
return sockopt_byte(self);
# else
return sockopt_int(self);
@@ -461,7 +461,7 @@ sockopt_ipv4_multicast_ttl(VALUE self)
UNREACHABLE;
}
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__OpenBSD__)
# define inspect_ipv4_multicast_ttl(a,b,c,d) inspect_byte(a,b,c,d)
#else
# define inspect_ipv4_multicast_ttl(a,b,c,d) inspect_int(a,b,c,d)
@@ -481,7 +481,7 @@ inspect_int(int level, int optname, VALUE data, VALUE ret)
}
}
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__OpenBSD__)
static int
inspect_byte(int level, int optname, VALUE data, VALUE ret)
{