ruby-changes:14185
From: yugui <ko1@a...>
Date: Sat, 5 Dec 2009 11:37:42 +0900 (JST)
Subject: [ruby-changes:14185] Ruby:r26004 (ruby_1_9_1): merges r21903 from trunk into ruby_1_9_1. fixes the backport task #1063.
yugui 2009-12-05 11:37:07 +0900 (Sat, 05 Dec 2009) New Revision: 26004 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26004 Log: merges r21903 from trunk into ruby_1_9_1. fixes the backport task #1063. -- * win32/win32.c (rb_w32_write): limit write size to 32KB if the file seems to be console. [ruby-core:21613] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/version.h branches/ruby_1_9_1/win32/win32.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 26003) +++ ruby_1_9_1/ChangeLog (revision 26004) @@ -1,3 +1,8 @@ +Fri Jan 30 18:04:23 2009 NAKAMURA Usaku <usa@r...> + + * win32/win32.c (rb_w32_write): limit write size to 32KB if the file + seems to be console. [ruby-core:21613] + Sat Oct 3 22:14:18 2009 Nobuyoshi Nakada <nobu@r...> * parse.y (bv_decls, bvar): fix for block variables. Index: ruby_1_9_1/win32/win32.c =================================================================== --- ruby_1_9_1/win32/win32.c (revision 26003) +++ ruby_1_9_1/win32/win32.c (revision 26004) @@ -4483,6 +4483,8 @@ DWORD written; DWORD wait; DWORD err; + size_t len; + size_t ret; OVERLAPPED ol, *pol = NULL; if (is_socket(sock)) @@ -4504,6 +4506,12 @@ 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)); @@ -4532,7 +4540,7 @@ 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) @@ -4580,9 +4588,16 @@ } } + 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 Index: ruby_1_9_1/version.h =================================================================== --- ruby_1_9_1/version.h (revision 26003) +++ ruby_1_9_1/version.h (revision 26004) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.1" -#define RUBY_PATCHLEVEL 360 +#define RUBY_PATCHLEVEL 361 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/