Skip to content

Commit

Permalink
* ext/socket/lib/socket.rb (Socket#recvmsg{,_nonblock}): default values
Browse files Browse the repository at this point in the history
  of clen must be nil.

* ext/socket/ancdata.c (bsock_sendmsg_internal): handle nil of clen.
  fixes test errors introduced at r52602.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
unak committed Nov 17, 2015
1 parent 4b9cd6e commit 66e2139
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Tue Nov 17 14:04:14 2015 NAKAMURA Usaku <usa@ruby-lang.org>

* 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 <usa@ruby-lang.org>

* ext/socket/lib/socket.rb: UNIXSocket is not always exists. fixes
Expand Down
2 changes: 1 addition & 1 deletion ext/socket/ancdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions ext/socket/lib/socket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def recv_nonblock(len, flag = 0, str = nil, exception: true)
# 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

Expand All @@ -441,7 +441,7 @@ def recvmsg(dlen = 4096, flags = 0, clen = 4096, scm_rights: false)
# 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
Expand Down

0 comments on commit 66e2139

Please sign in to comment.