summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/io.c b/io.c
index fbd24f6046..137bc77fb1 100644
--- a/io.c
+++ b/io.c
@@ -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);
}