diff --git a/ChangeLog b/ChangeLog index f5d1b5a2e3..48e4ed11f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Nov 17 14:04:14 2015 NAKAMURA Usaku + + * ext/socket/lib/socket.rb (Socket#recvmsg{,_nonblock}): default values + of clen must be nil. + + * ext/socket/ancdata.c (bsock_sendmsg_internal): handle nil of clen. + fixes test errors introduced at r52602. + Tue Nov 17 13:43:46 2015 NAKAMURA Usaku * ext/socket/lib/socket.rb: UNIXSocket is not always exists. fixes diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 7e0441c042..168f70c311 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -1467,7 +1467,7 @@ bsock_recvmsg_internal(VALUE sock, maxdatlen = NUM2SIZET(vmaxdatlen); #if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL) - maxctllen = NUM2SIZET(vmaxctllen); + maxctllen = NIL_P(vmaxctllen) ? 4096 : NUM2SIZET(vmaxctllen); #else if (!NIL_P(vmaxctllen)) rb_raise(rb_eArgError, "control message not supported"); diff --git a/ext/socket/lib/socket.rb b/ext/socket/lib/socket.rb index df526d73c6..58e7dfd92a 100644 --- a/ext/socket/lib/socket.rb +++ b/ext/socket/lib/socket.rb @@ -425,7 +425,7 @@ class BasicSocket < IO # return ancdata.unix_rights[0] # end # } - def recvmsg(dlen = 4096, flags = 0, clen = 4096, scm_rights: false) + def recvmsg(dlen = 4096, flags = 0, clen = nil, scm_rights: false) __recvmsg(dlen, flags, clen, scm_rights) end @@ -441,7 +441,7 @@ class BasicSocket < IO # By specifying `exception: false`, the _opts_ hash allows you to indicate # that recvmsg_nonblock should not raise an IO::WaitWritable exception, but # return the symbol :wait_writable instead. - def recvmsg_nonblock(dlen = 4096, flags = 0, clen = 4096, + def recvmsg_nonblock(dlen = 4096, flags = 0, clen = nil, scm_rights: false, exception: true) __recvmsg_nonblock(dlen, flags, clen, scm_rights, exception) end