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
@ -1129,23 +1129,24 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||||||
{
|
{
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
VALUE data, vflags, dest_sockaddr;
|
VALUE data, vflags, dest_sockaddr;
|
||||||
VALUE *controls_ptr;
|
|
||||||
int controls_num;
|
int controls_num;
|
||||||
struct msghdr mh;
|
struct msghdr mh;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
#if defined(HAVE_ST_MSG_CONTROL)
|
#if defined(HAVE_ST_MSG_CONTROL)
|
||||||
volatile VALUE controls_str = 0;
|
volatile VALUE controls_str = 0;
|
||||||
|
VALUE *controls_ptr = NULL;
|
||||||
|
int family;
|
||||||
#endif
|
#endif
|
||||||
int flags;
|
int flags;
|
||||||
ssize_t ss;
|
ssize_t ss;
|
||||||
int family;
|
|
||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
|
#if defined(HAVE_ST_MSG_CONTROL)
|
||||||
family = rsock_getfamily(fptr->fd);
|
family = rsock_getfamily(fptr->fd);
|
||||||
|
#endif
|
||||||
|
|
||||||
data = vflags = dest_sockaddr = Qnil;
|
data = vflags = dest_sockaddr = Qnil;
|
||||||
controls_ptr = NULL;
|
|
||||||
controls_num = 0;
|
controls_num = 0;
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
@ -1153,7 +1154,9 @@ bsock_sendmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||||||
data = argv[0];
|
data = argv[0];
|
||||||
if (1 < argc) vflags = argv[1];
|
if (1 < argc) vflags = argv[1];
|
||||||
if (2 < argc) dest_sockaddr = argv[2];
|
if (2 < argc) dest_sockaddr = argv[2];
|
||||||
|
#if defined(HAVE_ST_MSG_CONTROL)
|
||||||
if (3 < argc) { controls_ptr = &argv[3]; controls_num = argc - 3; }
|
if (3 < argc) { controls_ptr = &argv[3]; controls_num = argc - 3; }
|
||||||
|
#endif
|
||||||
|
|
||||||
StringValue(data);
|
StringValue(data);
|
||||||
|
|
||||||
@ -1475,11 +1478,11 @@ static VALUE
|
|||||||
bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
||||||
{
|
{
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
VALUE vmaxdatlen, vmaxctllen, vflags, vopts;
|
VALUE vmaxdatlen, vmaxctllen, vflags;
|
||||||
|
VALUE vopts;
|
||||||
int grow_buffer;
|
int grow_buffer;
|
||||||
size_t maxdatlen;
|
size_t maxdatlen;
|
||||||
int flags, orig_flags;
|
int flags, orig_flags;
|
||||||
int request_scm_rights;
|
|
||||||
struct msghdr mh;
|
struct msghdr mh;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
union_sockaddr namebuf;
|
union_sockaddr namebuf;
|
||||||
@ -1488,6 +1491,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||||||
VALUE ret;
|
VALUE ret;
|
||||||
ssize_t ss;
|
ssize_t ss;
|
||||||
#if defined(HAVE_ST_MSG_CONTROL)
|
#if defined(HAVE_ST_MSG_CONTROL)
|
||||||
|
int request_scm_rights;
|
||||||
struct cmsghdr *cmh;
|
struct cmsghdr *cmh;
|
||||||
size_t maxctllen;
|
size_t maxctllen;
|
||||||
union {
|
union {
|
||||||
@ -1502,11 +1506,7 @@ bsock_recvmsg_internal(int argc, VALUE *argv, VALUE sock, int nonblock)
|
|||||||
|
|
||||||
rb_secure(4);
|
rb_secure(4);
|
||||||
|
|
||||||
vopts = Qnil;
|
rb_scan_args(argc, argv, "03:", &vmaxdatlen, &vflags, &vmaxctllen, &vopts);
|
||||||
if (0 < argc && RB_TYPE_P(argv[argc-1], T_HASH))
|
|
||||||
vopts = argv[--argc];
|
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "03", &vmaxdatlen, &vflags, &vmaxctllen);
|
|
||||||
|
|
||||||
maxdatlen = NIL_P(vmaxdatlen) ? sizeof(datbuf0) : NUM2SIZET(vmaxdatlen);
|
maxdatlen = NIL_P(vmaxdatlen) ? sizeof(datbuf0) : NUM2SIZET(vmaxdatlen);
|
||||||
#if defined(HAVE_ST_MSG_CONTROL)
|
#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);
|
grow_buffer = NIL_P(vmaxdatlen) || NIL_P(vmaxctllen);
|
||||||
|
|
||||||
|
#if defined(HAVE_ST_MSG_CONTROL)
|
||||||
request_scm_rights = 0;
|
request_scm_rights = 0;
|
||||||
if (!NIL_P(vopts) && RTEST(rb_hash_aref(vopts, ID2SYM(rb_intern("scm_rights")))))
|
if (!NIL_P(vopts) && RTEST(rb_hash_aref(vopts, ID2SYM(rb_intern("scm_rights")))))
|
||||||
request_scm_rights = 1;
|
request_scm_rights = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
GetOpenFile(sock, fptr);
|
GetOpenFile(sock, fptr);
|
||||||
if (rb_io_read_pending(fptr)) {
|
if (rb_io_read_pending(fptr)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user