summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-10 11:21:42 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-10 11:21:42 +0000
commit1b0cbb6ae07e001893d7f08933a013851b60d0e0 (patch)
treefec1ce6ed4513d07f89d7c92f870291e10e8e31d /win32
parent33bb38a644c62edadec677465b2b08eea4756593 (diff)
* win32/win32.c (rb_w32_read): retry with reduced length if cannot to
write any data but no error occurs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 2661641266..308f4836f9 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -6497,6 +6497,7 @@ rb_w32_write(int fd, const void *buf, size_t size)
/* 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, size_t size)
goto retry;
}
if (ret == 0) {
+ size_t newlen = len / 2;
+ if (newlen > 0) {
+ size += len - newlen;
+ len = newlen;
+ goto retry2;
+ }
ret = -1;
errno = EWOULDBLOCK;
}