diff --git a/ChangeLog b/ChangeLog index 3ca7f8443e..9a9e911b9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Jun 12 02:25:54 2008 Nobuyoshi Nakada + + * io.c (rb_io_reopen): clear read buffer. + Thu Jun 12 00:56:20 2008 Nobuyoshi Nakada * ext/tk: check proper conditions. [ruby-dev:35047] diff --git a/io.c b/io.c index ced6a7aed7..a53e5589b6 100644 --- a/io.c +++ b/io.c @@ -4463,6 +4463,7 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file) if (fptr->mode & FMODE_WRITABLE) { io_fflush(fptr); } + fptr->rbuf_off = fptr->rbuf_len = 0; if (fptr->stdio_file) { if (freopen(fptr->path, mode, fptr->stdio_file) == 0) { diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 6e6a27f015..313fc0c864 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1038,6 +1038,14 @@ class TestIO < Test::Unit::TestCase safe_4 { r.reopen(t.path) } end end + + open(__FILE__) do |f| + f.gets + assert_nothing_raised { + f.reopen(t.path) + assert_equal("foo\n", f.gets) + } + end end def test_foreach diff --git a/version.h b/version.h index 6af69160a7..b04cf2d790 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2008-06-11" +#define RUBY_RELEASE_DATE "2008-06-12" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20080611 +#define RUBY_RELEASE_CODE 20080612 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 6 -#define RUBY_RELEASE_DAY 11 +#define RUBY_RELEASE_DAY 12 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];