From 6468b9bec07ae06fedfe431efca42fd38877d0c7 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 30 Sep 2016 15:55:41 +0000 Subject: [PATCH] merge revision(s) 56036,56041: [Backport #12713] * io.c (nogvl_fsync, nogvl_fdatasync): on Windows, just ignore if the fd is associated to non-disk device. if call fsync and/or fdatasync with such fds, it causes Errno::EBADF exception and the behavior is incomatible with ruby 2.1 and earlier unintendedly introduced. incompatible with ruby 2.1 and earlier unintentionally introduced. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@56306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ io.c | 8 ++++++++ version.h | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6ceb63411d..bef450bc7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Oct 1 00:55:19 2016 NAKAMURA Usaku + + * io.c (nogvl_fsync, nogvl_fdatasync): on Windows, just ignore if the + fd is associated to non-disk device. if call fsync and/or fdatasync + with such fds, it causes Errno::EBADF exception and the behavior is + incompatible with ruby 2.1 and earlier unintentionally introduced. + Sat Oct 1 00:53:28 2016 Kazuki Tsujimoto * array.c (flatten): use rb_obj_class instead of rb_class_of diff --git a/io.c b/io.c index 6f73953609..0cd5414a0d 100644 --- a/io.c +++ b/io.c @@ -1525,6 +1525,10 @@ nogvl_fsync(void *ptr) { rb_io_t *fptr = ptr; +#ifdef _WIN32 + if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) != FILE_TYPE_DISK) + return 0; +#endif return (VALUE)fsync(fptr->fd); } #endif @@ -1926,6 +1930,10 @@ nogvl_fdatasync(void *ptr) { rb_io_t *fptr = ptr; +#ifdef _WIN32 + if (GetFileType((HANDLE)rb_w32_get_osfhandle(fptr->fd)) != FILE_TYPE_DISK) + return 0; +#endif return (VALUE)fdatasync(fptr->fd); } diff --git a/version.h b/version.h index 99b8645b3f..f629b02d0a 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.6" #define RUBY_RELEASE_DATE "2016-10-01" -#define RUBY_PATCHLEVEL 375 +#define RUBY_PATCHLEVEL 376 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 10