mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
* 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
This commit is contained in:
parent
8f29ff7df2
commit
547584dd21
2 changed files with 16 additions and 5 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Mon Nov 7 23:39:23 2011 Tajima Akio <artonx@yahoo.co.jp>
|
||||||
|
|
||||||
|
* 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]
|
||||||
|
|
||||||
Mon Oct 10 22:33:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
Mon Oct 10 22:33:12 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||||
|
|
||||||
* test/-ext-/old_thread_select/test_old_thread_select.rb:
|
* test/-ext-/old_thread_select/test_old_thread_select.rb:
|
||||||
|
|
15
io.c
15
io.c
|
@ -684,11 +684,6 @@ io_fflush(rb_io_t *fptr)
|
||||||
return -1;
|
return -1;
|
||||||
rb_io_check_closed(fptr);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,6 +1062,11 @@ rb_io_flush(VALUE io)
|
||||||
if (fptr->mode & FMODE_WRITABLE) {
|
if (fptr->mode & FMODE_WRITABLE) {
|
||||||
if (io_fflush(fptr) < 0)
|
if (io_fflush(fptr) < 0)
|
||||||
rb_sys_fail(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) {
|
if (fptr->mode & FMODE_READABLE) {
|
||||||
io_unread(fptr);
|
io_unread(fptr);
|
||||||
|
@ -1199,6 +1199,11 @@ rb_io_rewind(VALUE io)
|
||||||
|
|
||||||
GetOpenFile(io, fptr);
|
GetOpenFile(io, fptr);
|
||||||
if (io_seek(fptr, 0L, 0) < 0 && errno) rb_sys_fail_path(fptr->pathv);
|
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) {
|
if (io == ARGF.current_file) {
|
||||||
ARGF.lineno -= fptr->lineno;
|
ARGF.lineno -= fptr->lineno;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue