summaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-21 17:42:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-21 17:42:56 +0000
commite3c9bd9156db7106bcefc651dfb45fd975941a42 (patch)
tree54b6e9a75d16d234e97b99dac649556a022a1a8b /eval.c
parent00ade54dff66975de84ca2248b381088ed4d2196 (diff)
downloadruby-e3c9bd9156db7106bcefc651dfb45fd975941a42.tar.gz
ruby-e3c9bd9156db7106bcefc651dfb45fd975941a42.tar.xz
ruby-e3c9bd9156db7106bcefc651dfb45fd975941a42.zip
* eval.c (rb_thread_fd_close): raise for writing threads.
[ruby-dev:20269] * io.c (rb_io_close, io_reopen): ditto. * io.c (io_reopen): keep stdio objects for stdin, stdout, and stderr. [ruby-dev:19442] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 3b8986aa8..ffd303290 100644
--- a/eval.c
+++ b/eval.c
@@ -8170,7 +8170,11 @@ rb_thread_fd_close(fd)
rb_thread_t th;
FOREACH_THREAD(th) {
- if ((th->wait_for & WAIT_FD) && fd == th->fd) {
+ if (((th->wait_for & WAIT_FD) && fd == th->fd) ||
+ ((th->wait_for & WAIT_SELECT) && (fd < th->fd) &&
+ (FD_ISSET(fd, &th->readfds) ||
+ FD_ISSET(fd, &th->writefds) ||
+ FD_ISSET(fd, &th->exceptfds)))) {
VALUE exc = rb_exc_new2(rb_eIOError, "stream closed");
rb_thread_raise(1, &exc, th);
}