summaryrefslogtreecommitdiff
path: root/ext/io
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-01 21:03:22 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-01 21:03:22 +0000
commit26e1ebdc1e3a26edada728000bb25b040d7ff4cc (patch)
treee86d8dc5933ad511141b78d9c107d94cde11316f /ext/io
parent40564c1e3b187fc593001ae80522e577dbb8eb50 (diff)
io/wait: fix return value for buffered read
* ext/io/wait/wait.c (io_nread): wrap return value with INT2FIX Thanks to Yura Sokolov <funny.falcon@gmail.com> [ruby-core:68369] [Bug#10923] * test/io/wait/test_io_wait.rb (test_nread_buffered): fix broken test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49797 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io')
-rw-r--r--ext/io/wait/wait.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index 7e17cb2..fd32be7 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -62,7 +62,7 @@ io_nread(VALUE io)
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
len = rb_io_read_pending(fptr);
- if (len > 0) return len;
+ if (len > 0) return INT2FIX(len);
if (!FIONREAD_POSSIBLE_P(fptr->fd)) return INT2FIX(0);
if (ioctl(fptr->fd, FIONREAD, &n)) return INT2FIX(0);
if (n > 0) return ioctl_arg2num(n);