summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--io.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 34db53450b..dbecb72df2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jun 2 12:33:09 2011 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * io.c (io_flush, rb_io_flush): need to fsync() when ruby calls internal
+ flush. [ruby-core:36670] [Bug #4813]
+
Thu Jun 2 07:56:24 2011 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* ext/tk/tcltklib.c: reduce CPU power required by an eventloop.
diff --git a/io.c b/io.c
index 0025f86073..e8f44dcd43 100644
--- a/io.c
+++ b/io.c
@@ -682,6 +682,9 @@ io_fflush(rb_io_t *fptr)
return -1;
rb_io_check_closed(fptr);
}
+#ifdef _WIN32
+ fsync(fptr->fd);
+#endif
return 0;
}
@@ -1054,9 +1057,6 @@ rb_io_flush(VALUE io)
if (fptr->mode & FMODE_WRITABLE) {
if (io_fflush(fptr) < 0)
rb_sys_fail(0);
-#ifdef _WIN32
- fsync(fptr->fd);
-#endif
}
if (fptr->mode & FMODE_READABLE) {
io_unread(fptr);