summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--io.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 71c4803e29..c127a142d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Feb 20 18:21:41 2006 Tanaka Akira <akr@m17n.org>
+
+ * io.c (rb_io_reopen): flush before reopening a file.
+ reported by Mathieu Bouchard. [ruby-core:7396]
+
Mon Feb 20 17:29:50 2006 Tanaka Akira <akr@m17n.org>
* mkconfig.rb: generate RbConfig instead of Config.
diff --git a/io.c b/io.c
index dd1058455a..e00325fa0d 100644
--- a/io.c
+++ b/io.c
@@ -3416,6 +3416,10 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
return file;
}
+ if (fptr->mode & FMODE_WRITABLE) {
+ io_fflush(fptr);
+ }
+
if (fptr->stdio_file) {
if (freopen(RSTRING(fname)->ptr, mode, fptr->stdio_file) == 0) {
rb_sys_fail(fptr->path);