aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-10-11 21:43:18 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-10-11 21:43:18 +0900
commitc866663784ea5a8f16e7fe5127127fb46ae90e6e (patch)
tree7c9fe678a9cf184dc8aff38d092576819e49b5ed /io.c
parent9e4a53fe13d8e3ad2e284dea8034bdd6a0561d97 (diff)
downloadruby-c866663784ea5a8f16e7fe5127127fb46ae90e6e.tar.gz
io.c (NUM2IOCTLREQ): Accept a value more than INT_MAX
ioctl accepts int as request arguments on some platforms, but some requests are more than INT_MAX, e.g., RNDGETENTCNT(0x80045200). Passing (0x80045200 | (-1 << 32)) may work around the issue, but it may not work on a platform where ioctl accepts unsigned long. So this change uses NUM2LONG and then casts it to int.
Diffstat (limited to 'io.c')
-rw-r--r--io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io.c b/io.c
index 2de3cebefb..33350ea752 100644
--- a/io.c
+++ b/io.c
@@ -9565,7 +9565,7 @@ rb_f_select(int argc, VALUE *argv, VALUE obj)
# define NUM2IOCTLREQ(num) NUM2ULONG(num)
#else
typedef int ioctl_req_t;
-# define NUM2IOCTLREQ(num) NUM2INT(num)
+# define NUM2IOCTLREQ(num) ((int)NUM2LONG(num))
#endif
#ifdef HAVE_IOCTL