diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-15 11:53:41 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-15 11:53:41 +0000 |
commit | d6af2a2b214203da5b4bb8ef592026db3c4c1a40 (patch) | |
tree | b715d017ae6f8e479678fc4a7dc35ef5e79d9615 /file.c | |
parent | 12a0b0c8f48f168994245198e62d1d40cab5d594 (diff) | |
download | ruby-d6af2a2b214203da5b4bb8ef592026db3c4c1a40.tar.gz |
* io.c, internal.h (rb_io_flush_raw): new function to select calling
fsync() (on Windows).
* io.c (rb_io_flush_raw): use above function.
* file.c (rb_file_truncate): use above function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -4244,7 +4244,11 @@ rb_file_truncate(VALUE obj, VALUE len) if (!(fptr->mode & FMODE_WRITABLE)) { rb_raise(rb_eIOError, "not opened for writing"); } +#ifndef _WIN32 rb_io_flush(obj); +#else + rb_io_flush_raw(obj, 0); +#endif #ifdef HAVE_FTRUNCATE if (ftruncate(fptr->fd, pos) < 0) rb_sys_fail_path(fptr->pathv); |