summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-11 17:25:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-11 17:25:57 +0000
commit1d09b69f62d1f779f4f446a743036b6fe8c5d59a (patch)
tree47db064ab69163c62130850e7c228d8377509b92
parentcf508bfedad6613d69b1d784a3a804538eae55d0 (diff)
* io.c (rb_io_reopen): clear read buffer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17100 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--io.c1
-rw-r--r--test/ruby/test_io.rb8
-rw-r--r--version.h6
4 files changed, 16 insertions, 3 deletions
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 <nobu@ruby-lang.org>
+
+ * io.c (rb_io_reopen): clear read buffer.
+
Thu Jun 12 00:56:20 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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[];