1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ext/socket/ancdata.c (bsock_sendmsg_internal): portability fix

* ext/socket/ancdata.c (bsock_sendmsg_internal): avoid msg_control
  ptr if msg_controllen is zero to fix portability problems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2015-06-05 08:28:14 +00:00
parent 20dedbfd9d
commit 7ac8fe7407
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri Jun 5 17:27:30 2015 Eric Wong <e@80x24.org>
* ext/socket/ancdata.c (bsock_sendmsg_internal): avoid msg_control
ptr if msg_controllen is zero to fix portability problems.
Fri Jun 5 09:17:45 2015 Eric Wong <e@80x24.org>
* ext/socket/ancdata.c (bsock_sendmsg_internal): fix build error

View file

@ -1134,6 +1134,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
struct msghdr mh;
struct iovec iov;
VALUE controls = Qnil;
int controls_num;
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
VALUE controls_str = 0;
int family;
@ -1157,11 +1158,11 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
#endif
StringValue(data);
controls_num = RARRAY_LENINT(controls);
if (!NIL_P(controls)) {
if (controls_num) {
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
int i;
int controls_num = RARRAY_LENINT(controls);
size_t last_pad = 0;
const VALUE *controls_ptr = RARRAY_CONST_PTR(controls);
#if defined(__NetBSD__)