From 24418e0c776a4dbde26515099309da9d1ae79748 Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 5 Sep 2018 13:15:41 +0000 Subject: [PATCH] AIX doesn't set OptionLength for boolean options https://rubyci.org/logs/rubyci.s3.amazonaws.com/aix71_ppc/ruby-trunk/log/20180904T103302Z.fail.html.gz https://www.ibm.com/support/knowledgecenter/ja/ssw_aix_72/com.ibm.aix.commtrf2/getsockopt.htm git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/basicsocket.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ext/socket/basicsocket.c b/ext/socket/basicsocket.c index 2641b4410b..53a2daaa63 100644 --- a/ext/socket/basicsocket.c +++ b/ext/socket/basicsocket.c @@ -314,6 +314,18 @@ bsock_getsockopt(VALUE sock, VALUE lev, VALUE optname) level = rsock_level_arg(family, lev); option = rsock_optname_arg(family, level, optname); len = 256; +#ifdef Qnil + switch (option) { + case SO_DEBUG: + case SO_REUSEADDR: + case SO_KEEPALIVE: + case SO_DONTROUTE: + case SO_BROADCAST: + case SO_OOBINLINE: + /* AIX doesn' set len for boolean options */ + len = sizeof(int); + } +#endif buf = ALLOCA_N(char,len); rb_io_check_closed(fptr);