summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorarton <arton@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-07 14:45:27 +0000
committerarton <arton@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-07 14:45:27 +0000
commit547584dd2168e2bc3da6088db47541f8bdf03dba (patch)
tree8fd04fabb822ce3fc11ec0e054c84bd3b05050a7 /io.c
parent8f29ff7df2fc44fe7fa059dfa3ccb4382617a47a (diff)
* io.c (io_fflush): remove fsync().
* io.c (rb_io_flush, rb_io_rewind): fsync() here. These pathces are backports of trunk r33651 for [Bug #5585] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/io.c b/io.c
index acb6253e26..c8f941b065 100644
--- a/io.c
+++ b/io.c
@@ -684,11 +684,6 @@ io_fflush(rb_io_t *fptr)
return -1;
rb_io_check_closed(fptr);
}
-#ifdef _WIN32
- if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
- fsync(fptr->fd);
- }
-#endif
return 0;
}
@@ -1067,6 +1062,11 @@ rb_io_flush(VALUE io)
if (fptr->mode & FMODE_WRITABLE) {
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
+#ifdef _WIN32
+ if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
+ fsync(fptr->fd);
+ }
+#endif
}
if (fptr->mode & FMODE_READABLE) {
io_unread(fptr);
@@ -1199,6 +1199,11 @@ rb_io_rewind(VALUE io)
GetOpenFile(io, fptr);
if (io_seek(fptr, 0L, 0) < 0 && errno) rb_sys_fail_path(fptr->pathv);
+#ifdef _WIN32
+ if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) == FILE_TYPE_DISK) {
+ fsync(fptr->fd);
+ }
+#endif
if (io == ARGF.current_file) {
ARGF.lineno -= fptr->lineno;
}