diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/socket/mkconstants.rb | 2 | ||||
-rw-r--r-- | ext/socket/socket.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/ext/socket/mkconstants.rb b/ext/socket/mkconstants.rb index 9dce82495..da15fb4c7 100644 --- a/ext/socket/mkconstants.rb +++ b/ext/socket/mkconstants.rb @@ -228,11 +228,13 @@ ip_optname_to_int(char *str, int len, int *valp) <%= gen_name_to_int("str", "len", "valp", /\AIP_/, "IP_") %> } +#ifdef IPPROTO_IPV6 static int ipv6_optname_to_int(char *str, int len, int *valp) { <%= gen_name_to_int("str", "len", "valp", /\AIPV6_/, "IPV6_") %> } +#endif static int tcp_optname_to_int(char *str, int len, int *valp) diff --git a/ext/socket/socket.c b/ext/socket/socket.c index 08efab52d..3751303a9 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -242,7 +242,7 @@ ruby_getnameinfo__aix(sa, salen, host, hostlen, serv, servlen, flags) #endif static int -constant_arg(VALUE arg, int (*str_to_int)(char*, int, int*), char *errmsg) +constant_arg(VALUE arg, int (*str_to_int)(char*, int, int*), const char *errmsg) { VALUE tmp; char *ptr; @@ -295,8 +295,10 @@ optname_arg(int level, VALUE optname) return constant_arg(optname, so_optname_to_int, "unknown socket level option name"); case IPPROTO_IP: return constant_arg(optname, ip_optname_to_int, "unknown IP level option name"); +#ifdef IPPROTO_IPV6 case IPPROTO_IPV6: return constant_arg(optname, ipv6_optname_to_int, "unknown IPv6 level option name"); +#endif case IPPROTO_TCP: return constant_arg(optname, tcp_optname_to_int, "unknown TCP level option name"); case IPPROTO_UDP: |