ruby-changes:14004
From: shyouhei <ko1@a...>
Date: Tue, 17 Nov 2009 15:44:40 +0900 (JST)
Subject: [ruby-changes:14004] Ruby:r25812 (ruby_1_8_7): merge revision(s) 24751:
shyouhei 2009-11-17 15:44:28 +0900 (Tue, 17 Nov 2009) New Revision: 25812 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25812 Log: merge revision(s) 24751: * io.c (rb_io_binmode): check if closed regardless platforms. [ruby-core:25363] Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/io.c branches/ruby_1_8_7/test/ruby/test_io.rb branches/ruby_1_8_7/version.h Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 25811) +++ ruby_1_8_7/ChangeLog (revision 25812) @@ -1,3 +1,8 @@ +Tue Nov 17 15:32:27 2009 Nobuyoshi Nakada <nobu@r...> + + * io.c (rb_io_binmode): check if closed regardless platforms. + [ruby-core:25363] + Tue Nov 17 15:31:09 2009 Nobuyoshi Nakada <nobu@r...> * numeric.c (round): added declaration. [ruby-dev:39222] Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 25811) +++ ruby_1_8_7/version.h (revision 25812) @@ -2,7 +2,7 @@ #define RUBY_RELEASE_DATE "2009-11-17" #define RUBY_VERSION_CODE 187 #define RUBY_RELEASE_CODE 20091117 -#define RUBY_PATCHLEVEL 206 +#define RUBY_PATCHLEVEL 207 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 Index: ruby_1_8_7/io.c =================================================================== --- ruby_1_8_7/io.c (revision 25811) +++ ruby_1_8_7/io.c (revision 25812) @@ -2696,11 +2696,11 @@ rb_io_binmode(io) VALUE io; { -#if defined(_WIN32) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__EMX__) rb_io_t *fptr; GetOpenFile(io, fptr); -#ifdef __human68k__ +#if (defined(O_BINARY) && O_BINARY) || (defined(_IOBIN) && _IOBIN) +#if (defined(_IOBIN) && _IOBIN) /* __human68k__ */ if (fptr->f) fmode(fptr->f, _IOBIN); if (fptr->f2) Index: ruby_1_8_7/test/ruby/test_io.rb =================================================================== --- ruby_1_8_7/test/ruby/test_io.rb (revision 25811) +++ ruby_1_8_7/test/ruby/test_io.rb (revision 25812) @@ -1,5 +1,6 @@ require 'test/unit' require 'tmpdir' +require 'tempfile' class TestIO < Test::Unit::TestCase def mkcdtmpdir @@ -28,4 +29,20 @@ } } end + + def make_tempfile + t = Tempfile.new("foo") + t.binmode + t.puts "foo" + t.puts "bar" + t.puts "baz" + t.close + t + end + + def test_binmode_after_closed + t = make_tempfile + t.close + assert_raise(IOError) {t.binmode} + end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/