mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ancdata.c: suppress warnings
* ext/socket/ancdata.c (bsock_sendmsg_internal): suppress warnings on platforms where msghdr does not have msg_control. * ext/socket/ancdata.c (bsock_recvmsg_internal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bb35edf33c
commit
84c8319c8d
1 changed files with 12 additions and 10 deletions
|
@ -1129,23 +1129,24 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
{
|
||||
rb_io_t *fptr;
|
||||
VALUE data, vflags, dest_sockaddr;
|
||||
VALUE *controls_ptr;
|
||||
int controls_num;
|
||||
struct msghdr mh;
|
||||
struct iovec iov;
|
||||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
volatile VALUE controls_str = 0;
|
||||
VALUE *controls_ptr = NULL;
|
||||
int family;
|
||||
#endif
|
||||
int flags;
|
||||
ssize_t ss;
|
||||
int family;
|
||||
|
||||
rb_secure(4);
|
||||
GetOpenFile(sock, fptr);
|
||||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
family = rsock_getfamily(fptr->fd);
|
||||
#endif
|
||||
|
||||
data = vflags = dest_sockaddr = Qnil;
|
||||
controls_ptr = NULL;
|
||||
controls_num = 0;
|
||||
|
||||
if (argc == 0)
|
||||
|
@ -1153,7 +1154,9 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
data = argv[0];
|
||||
if (1 < argc) vflags = argv[1];
|
||||
if (2 < argc) dest_sockaddr = argv[2];
|
||||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
if (3 < argc) { controls_ptr = &argv[3]; controls_num = argc - 3; }
|
||||
#endif
|
||||
|
||||
StringValue(data);
|
||||
|
||||
|
@ -1475,11 +1478,11 @@ static VALUE
|
|||
bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
||||
{
|
||||
rb_io_t *fptr;
|
||||
VALUE vmaxdatlen, vmaxctllen, vflags, vopts;
|
||||
VALUE vmaxdatlen, vmaxctllen, vflags;
|
||||
VALUE vopts;
|
||||
int grow_buffer;
|
||||
size_t maxdatlen;
|
||||
int flags, orig_flags;
|
||||
int request_scm_rights;
|
||||
struct msghdr mh;
|
||||
struct iovec iov;
|
||||
union_sockaddr namebuf;
|
||||
|
@ -1488,6 +1491,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
VALUE ret;
|
||||
ssize_t ss;
|
||||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
int request_scm_rights;
|
||||
struct cmsghdr *cmh;
|
||||
size_t maxctllen;
|
||||
union {
|
||||
|
@ -1502,11 +1506,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
|
||||
rb_secure(4);
|
||||
|
||||
vopts = Qnil;
|
||||
if (0 < argc && RB_TYPE_P(argv[argc-1], T_HASH))
|
||||
vopts = argv[--argc];
|
||||
|
||||
rb_scan_args(argc, argv, "03", &vmaxdatlen, &vflags, &vmaxctllen);
|
||||
rb_scan_args(argc, argv, "03:", &vmaxdatlen, &vflags, &vmaxctllen, &vopts);
|
||||
|
||||
maxdatlen = NIL_P(vmaxdatlen) ? sizeof(datbuf0) : NUM2SIZET(vmaxdatlen);
|
||||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
|
@ -1524,9 +1524,11 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||
|
||||
grow_buffer = NIL_P(vmaxdatlen) || NIL_P(vmaxctllen);
|
||||
|
||||
#if defined(HAVE_ST_MSG_CONTROL)
|
||||
request_scm_rights = 0;
|
||||
if (!NIL_P(vopts) && RTEST(rb_hash_aref(vopts, ID2SYM(rb_intern("scm_rights")))))
|
||||
request_scm_rights = 1;
|
||||
#endif
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
if (rb_io_read_pending(fptr)) {
|
||||
|
|
Loading…
Reference in a new issue