mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (rb_w32_write): limit write size to 32KB if the file
seems to be console. [ruby-core:21613] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
374e2f34b1
commit
7a4a31064a
2 changed files with 23 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Jan 30 18:04:23 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* win32/win32.c (rb_w32_write): limit write size to 32KB if the file
|
||||
seems to be console. [ruby-core:21613]
|
||||
|
||||
Fri Jan 30 16:12:32 2009 TAKAO Kouji <kouji@takao7.net>
|
||||
|
||||
* ext/curses/curses.c (Init_curses): Curses#crmode and
|
||||
|
@ -11,7 +16,7 @@ Fri Jan 30 14:31:14 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
|||
|
||||
Fri Jan 30 14:11:48 2009 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* enc/depend: extract comile rules to each target for VC++.
|
||||
* enc/depend: extract compile rules to each target for nmake.
|
||||
|
||||
Fri Jan 30 12:59:49 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
|
|
|
@ -4485,6 +4485,8 @@ rb_w32_write(int fd, const void *buf, size_t size)
|
|||
DWORD written;
|
||||
DWORD wait;
|
||||
DWORD err;
|
||||
size_t len;
|
||||
size_t ret;
|
||||
OVERLAPPED ol, *pol = NULL;
|
||||
|
||||
if (is_socket(sock))
|
||||
|
@ -4506,6 +4508,12 @@ rb_w32_write(int fd, const void *buf, size_t size)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
retry:
|
||||
/* get rid of console writing bug */
|
||||
len = (_osfile(fd) & FDEV) ? min(32 * 1024, size) : size;
|
||||
size -= len;
|
||||
|
||||
/* if have cancel_io, use Overlapped I/O */
|
||||
if (cancel_io) {
|
||||
memset(&ol, 0, sizeof(ol));
|
||||
|
@ -4534,7 +4542,7 @@ rb_w32_write(int fd, const void *buf, size_t size)
|
|||
pol = &ol;
|
||||
}
|
||||
|
||||
if (!WriteFile((HANDLE)_osfhnd(fd), buf, size, &written, pol)) {
|
||||
if (!WriteFile((HANDLE)_osfhnd(fd), buf, len, &written, pol)) {
|
||||
err = GetLastError();
|
||||
if (err != ERROR_IO_PENDING) {
|
||||
if (err == ERROR_ACCESS_DENIED)
|
||||
|
@ -4582,9 +4590,16 @@ rb_w32_write(int fd, const void *buf, size_t size)
|
|||
}
|
||||
}
|
||||
|
||||
ret += written;
|
||||
if (written == len) {
|
||||
(const char *)buf += len;
|
||||
if (size > 0)
|
||||
goto retry;
|
||||
}
|
||||
|
||||
MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));
|
||||
|
||||
return written;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
Loading…
Add table
Reference in a new issue