From 9681409e3691037c11c19052295616454f74c936 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 14 Jul 2009 07:13:11 +0000 Subject: * io.c (rb_io_initialize): check if the descriptor can be accessed in the specified open mode. [ruby-dev:38571] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 69e3666cff..8a5b878f3b 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1379,6 +1379,9 @@ class TestIO < Test::Unit::TestCase fd = IO.sysopen(t.path, "w") assert_kind_of(Integer, fd) + %w[r r+ w+ a+].each do |mode| + assert_raise(Errno::EINVAL, '[ruby-dev:38571]') {IO.new(fd, mode)} + end f = IO.new(fd, "w") f.write("FOO\n") f.close -- cgit v1.2.3