Permalink
Browse files

fix rb_io_check_readable/rb_io_check_writeable to accept O_RDWR also

  • Loading branch information...
Nikolai Lugovoi
Nikolai Lugovoi committed Mar 25, 2011
1 parent 7ed3952 commit a50ca60e333743a4b79609fb03fbf9702075d401
Showing with 4 additions and 4 deletions.
  1. +4 −4 vm/capi/io.cpp
View
@@ -267,8 +267,8 @@ extern "C" {
VALUE io_handle = iot->handle;
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
IO* io = c_as<IO>(env->get_object(io_handle));
if ((io->mode()->to_native() & O_ACCMODE) != O_RDONLY) {
int io_mode = io->mode()->to_native() & O_ACCMODE;
if (!(O_RDONLY == io_mode || O_RDWR == io_mode)) {
rb_raise(rb_eIOError, "not opened for reading");
}
}
@@ -277,8 +277,8 @@ extern "C" {
VALUE io_handle = iot->handle;
NativeMethodEnvironment* env = NativeMethodEnvironment::get();
IO* io = c_as<IO>(env->get_object(io_handle));
if ((io->mode()->to_native() & O_ACCMODE) != O_WRONLY) {
int io_mode = io->mode()->to_native() & O_ACCMODE;
if (!(O_WRONLY == io_mode || O_RDWR == io_mode)) {
rb_raise(rb_eIOError, "not opened for writing");
}
}

0 comments on commit a50ca60

Please sign in to comment.