1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (select_internal): IO which cbuf is not empty is readable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-04-26 21:21:07 +00:00
parent 18abe0e8c2
commit 87ba383aa3
3 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Tue Apr 27 06:20:13 2010 Tanaka Akira <akr@fsij.org>
* io.c (select_internal): IO which cbuf is not empty is readable.
Tue Apr 27 00:07:32 2010 Yusuke Endoh <mame@tsg.ne.jp>
* parse.y (program): check void_expr when rb_parse_in_main().

2
io.c
View file

@ -7153,7 +7153,7 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
for (i=0; i<RARRAY_LEN(read); i++) {
GetOpenFile(rb_io_get_io(RARRAY_PTR(read)[i]), fptr);
rb_fd_set(fptr->fd, &fds[0]);
if (READ_DATA_PENDING(fptr)) { /* check for buffered data */
if (READ_DATA_PENDING(fptr) || READ_CHAR_PENDING(fptr)) { /* check for buffered data */
pending++;
rb_fd_set(fptr->fd, &fds[3]);
}

View file

@ -1774,5 +1774,15 @@ EOT
}
end
def test_cbuf_select
with_tmpdir {
r, w = IO.pipe
w << "\r\n"
r.set_encoding("US-ASCII:UTF-8", :universal_newline => true)
r.ungetc(r.getc)
assert_equal([[r],[],[]], IO.select([r], nil, nil, 1))
}
end
end