summaryrefslogtreecommitdiff
path: root/ext/socket/ancdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/ancdata.c')
-rw-r--r--ext/socket/ancdata.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index 93615f2766..c54df04038 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -1580,13 +1580,13 @@ bsock_recvmsg_internal(VALUE sock,
if (grow_buffer) {
int grown = 0;
-#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
- if (NIL_P(vmaxdatlen) && (mh.msg_flags & MSG_TRUNC)) {
+ if (NIL_P(vmaxdatlen) && ss != -1 && ss == (ssize_t)iov.iov_len) {
if (SIZE_MAX/2 < maxdatlen)
rb_raise(rb_eArgError, "max data length too big");
maxdatlen *= 2;
grown = 1;
}
+#if defined(HAVE_STRUCT_MSGHDR_MSG_CONTROL)
if (NIL_P(vmaxctllen) && (mh.msg_flags & MSG_CTRUNC)) {
#define BIG_ENOUGH_SPACE 65536
if (BIG_ENOUGH_SPACE < maxctllen &&
@@ -1606,13 +1606,6 @@ bsock_recvmsg_internal(VALUE sock,
}
#undef BIG_ENOUGH_SPACE
}
-#else
- if (NIL_P(vmaxdatlen) && ss != -1 && ss == (ssize_t)iov.iov_len) {
- if (SIZE_MAX/2 < maxdatlen)
- rb_raise(rb_eArgError, "max data length too big");
- maxdatlen *= 2;
- grown = 1;
- }
#endif
if (grown) {
rsock_discard_cmsg_resource(&mh, (flags & MSG_PEEK) != 0);