diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-30 05:59:17 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-08-30 05:59:17 +0000 |
commit | f48dbbf07455ee4362003c8ecc19612a4d6769d4 (patch) | |
tree | 5f71bbcc2b8f1bb459bb29de470f8b5055b89ead /io.c | |
parent | 6156ce909d09ea3938f03dafed0a4610c40c605e (diff) | |
download | ruby-f48dbbf07455ee4362003c8ecc19612a4d6769d4.tar.gz |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1533,6 +1533,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 @@ -1935,6 +1939,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); } |