Skip to content

Commit

Permalink
* io.c (select_internal): IO which cbuf is not empty is readable.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
akr committed Apr 26, 2010
1 parent 18abe0e commit 87ba383
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Tue Apr 27 06:20:13 2010 Tanaka Akira <[email protected]>

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

Tue Apr 27 00:07:32 2010 Yusuke Endoh <[email protected]>

* parse.y (program): check void_expr when rb_parse_in_main().
Expand Down
2 changes: 1 addition & 1 deletion io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down
10 changes: 10 additions & 0 deletions test/ruby/test_io_m17n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1774,5 +1774,15 @@ def test_text_mode_ungetc_eof
}
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

0 comments on commit 87ba383

Please sign in to comment.