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:
parent
20dedbfd9d
commit
7ac8fe7407
2 changed files with 8 additions and 2 deletions
|
@ -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>
|
Fri Jun 5 09:17:45 2015 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
* ext/socket/ancdata.c (bsock_sendmsg_internal): fix build error
|
* ext/socket/ancdata.c (bsock_sendmsg_internal): fix build error
|
||||||
|
|
|
@ -1134,6 +1134,7 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
||||||
struct msghdr mh;
|
struct msghdr mh;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
VALUE controls = Qnil;
|
VALUE controls = Qnil;
|
||||||
|
int controls_num;
|
||||||
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
||||||
VALUE controls_str = 0;
|
VALUE controls_str = 0;
|
||||||
int family;
|
int family;
|
||||||
|
@ -1157,11 +1158,11 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StringValue(data);
|
StringValue(data);
|
||||||
|
controls_num = RARRAY_LENINT(controls);
|
||||||
|
|
||||||
if (!NIL_P(controls)) {
|
if (controls_num) {
|
||||||
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
|
||||||
int i;
|
int i;
|
||||||
int controls_num = RARRAY_LENINT(controls);
|
|
||||||
size_t last_pad = 0;
|
size_t last_pad = 0;
|
||||||
const VALUE *controls_ptr = RARRAY_CONST_PTR(controls);
|
const VALUE *controls_ptr = RARRAY_CONST_PTR(controls);
|
||||||
#if defined(__NetBSD__)
|
#if defined(__NetBSD__)
|
||||||
|
|
Loading…
Add table
Reference in a new issue