diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-20 09:23:26 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-02-20 09:23:26 +0000 |
| commit | 6228fcbb2d68db2f6a696e21d2f27c276da310ed (patch) | |
| tree | b1873b9b10b09402656105f9cec4b2b48aade3f0 | |
| parent | c606dc09e102189ae9a652aeff0816b554c0fa4d (diff) | |
| download | ruby-6228fcbb2d68db2f6a696e21d2f27c276da310ed.tar.gz ruby-6228fcbb2d68db2f6a696e21d2f27c276da310ed.tar.xz ruby-6228fcbb2d68db2f6a696e21d2f27c276da310ed.zip | |
* io.c (rb_io_reopen): flush before reopening a file.
reported by Mathieu Bouchard. [ruby-core:7396]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | io.c | 4 |
2 files changed, 9 insertions, 0 deletions
@@ -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. @@ -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); |
