[前][次][番号順一覧][スレッド一覧]

ruby-changes:43963

From: usa <ko1@a...>
Date: Tue, 30 Aug 2016 14:59:23 +0900 (JST)
Subject: [ruby-changes:43963] usa:r56036 (trunk): * io.c (nogvl_fsync, nogvl_fdatasync): on Windows, just ignore if the

usa	2016-08-30 14:59:17 +0900 (Tue, 30 Aug 2016)

  New Revision: 56036

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56036

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/io.c
Index: io.c
===================================================================
--- io.c	(revision 56035)
+++ io.c	(revision 56036)
@@ -1533,6 +1533,10 @@ nogvl_fsync(void *ptr) https://github.com/ruby/ruby/blob/trunk/io.c#L1533
 {
     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) https://github.com/ruby/ruby/blob/trunk/io.c#L1939
 {
     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);
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 56035)
+++ ChangeLog	(revision 56036)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Aug 30 14:53:34 2016  NAKAMURA Usaku  <usa@r...>
+
+	* 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.
+
 Tue Aug 30 03:38:35 2016  NARUSE, Yui  <naruse@r...>
 
 	* vm_dump.c (backtrace): use rip in the saved context for the case

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]