aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/io.c b/io.c
index 0b0a278697..89932953ef 100644
--- a/io.c
+++ b/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
/*