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): should return original value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
gotoyuzo 2007-12-20 16:12:38 +00:00
parent cfb91bc2f5
commit d86caf3188
2 changed files with 14 additions and 7 deletions

View file

@ -1,3 +1,7 @@
Fri Dec 21 01:11:37 2007 GOTOU Yuuzou <gotoyuzo@notwork.org>
* io.c (select_internal): should return original value.
Fri Dec 21 00:26:39 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (tr_trans): wrong encoding check for tree strings.

17
io.c
View file

@ -5069,11 +5069,12 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (rp) {
list = RARRAY_PTR(res)[0];
for (i=0; i< RARRAY_LEN(read); i++) {
VALUE io = rb_io_get_io(rb_ary_entry(read, i));
VALUE obj = rb_ary_entry(read, i);
VALUE io = rb_io_get_io(obj);
GetOpenFile(io, fptr);
if (rb_fd_isset(fptr->fd, &fds[0]) ||
rb_fd_isset(fptr->fd, &fds[3])) {
rb_ary_push(list, io);
rb_ary_push(list, obj);
}
}
}
@ -5081,11 +5082,12 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (wp) {
list = RARRAY_PTR(res)[1];
for (i=0; i< RARRAY_LEN(write); i++) {
VALUE io = rb_io_get_io(rb_ary_entry(write, i));
VALUE obj = rb_ary_entry(write, i);
VALUE io = rb_io_get_io(obj);
VALUE write_io = GetWriteIO(io);
GetOpenFile(write_io, fptr);
if (rb_fd_isset(fptr->fd, &fds[1])) {
rb_ary_push(list, io);
rb_ary_push(list, obj);
}
}
}
@ -5093,16 +5095,17 @@ select_internal(VALUE read, VALUE write, VALUE except, struct timeval *tp, rb_fd
if (ep) {
list = RARRAY_PTR(res)[2];
for (i=0; i< RARRAY_LEN(except); i++) {
VALUE io = rb_io_get_io(rb_ary_entry(write, i));
VALUE obj = rb_ary_entry(write, i);
VALUE io = rb_io_get_io(obj);
VALUE write_io = GetWriteIO(io);
GetOpenFile(io, fptr);
if (rb_fd_isset(fptr->fd, &fds[2])) {
rb_ary_push(list, io);
rb_ary_push(list, obj);
}
else if (io != write_io) {
GetOpenFile(write_io, fptr);
if (rb_fd_isset(fptr->fd, &fds[2])) {
rb_ary_push(list, io);
rb_ary_push(list, obj);
}
}
}