mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (rb_io_fdatasync): Use fsync(2) if if the underlying
operating system does not support fdatasync(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
de15b19498
commit
3722e3a29a
2 changed files with 13 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Feb 2 17:09:22 2011 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* io.c (rb_io_fdatasync): Use fsync(2) if if the underlying
|
||||
operating system does not support fdatasync(2).
|
||||
|
||||
Wed Feb 2 14:51:08 2011 Eric Hodel <drbrain@segment7.net>
|
||||
|
||||
* lib/rdoc/markup/to_tt_only.rb: commit miss
|
||||
|
|
12
io.c
12
io.c
|
@ -1421,18 +1421,22 @@ static VALUE
|
|||
rb_io_fdatasync(VALUE io)
|
||||
{
|
||||
rb_io_t *fptr;
|
||||
int saved_errno = 0;
|
||||
|
||||
io = GetWriteIO(io);
|
||||
GetOpenFile(io, fptr);
|
||||
|
||||
if (io_fflush(fptr) < 0)
|
||||
rb_sys_fail(0);
|
||||
if (fdatasync(fptr->fd) < 0)
|
||||
rb_sys_fail_path(fptr->pathv);
|
||||
return INT2FIX(0);
|
||||
|
||||
if (fdatasync(fptr->fd) == 0)
|
||||
return INT2FIX(0);
|
||||
|
||||
/* fall back */
|
||||
return rb_io_fsync(io);
|
||||
}
|
||||
#else
|
||||
#define rb_io_fdatasync rb_f_notimplement
|
||||
#define rb_io_fdatasync rb_io_fsync
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue