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

ruby-changes:36282

From: usa <ko1@a...>
Date: Mon, 10 Nov 2014 20:21:49 +0900 (JST)
Subject: [ruby-changes:36282] usa:r48363 (trunk): * win32/win32.c (rb_w32_read): retry with reduced length if cannot to

usa	2014-11-10 20:21:42 +0900 (Mon, 10 Nov 2014)

  New Revision: 48363

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

  Log:
    * win32/win32.c (rb_w32_read): retry with reduced length if cannot to
      write any data but no error occurs.

  Modified files:
    trunk/ChangeLog
    trunk/win32/win32.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 48362)
+++ ChangeLog	(revision 48363)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Nov 10 20:20:53 2014  NAKAMURA Usaku  <usa@r...>
+
+	* win32/win32.c (rb_w32_read): retry with reduced length if cannot to
+	  write any data but no error occurs.
+
 Mon Nov 10 20:04:16 2014  Tanaka Akira  <akr@f...>
 
 	* lib/webrick/server.rb: Setup shutdown pipe in listen method.
Index: win32/win32.c
===================================================================
--- win32/win32.c	(revision 48362)
+++ win32/win32.c	(revision 48363)
@@ -6497,6 +6497,7 @@ rb_w32_write(int fd, const void *buf, si https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L6497
     /* get rid of console writing bug */
     len = (_osfile(fd) & FDEV) ? min(32 * 1024, size) : size;
     size -= len;
+  retry2:
 
     /* if have cancel_io, use Overlapped I/O */
     if (cancel_io) {
@@ -6556,6 +6557,12 @@ rb_w32_write(int fd, const void *buf, si https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L6557
 	    goto retry;
     }
     if (ret == 0) {
+	size_t newlen = len / 2;
+	if (newlen > 0) {
+	    size += len - newlen;
+	    len = newlen;
+	    goto retry2;
+	}
 	ret = -1;
 	errno = EWOULDBLOCK;
     }

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

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