diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index 068784e149..5a7e596863 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -6765,6 +6765,10 @@ constat_apply(HANDLE handle, struct constat *s, WCHAR w) } } +/* get rid of console writing bug; assume WriteConsole and WriteFile + * on a console share the same limit. */ +static const long MAXSIZE_CONSOLE_WRITING = 31366; + /* License: Ruby's */ static long constat_parse(HANDLE h, struct constat *s, const WCHAR **ptrp, long *lenp) @@ -6819,7 +6823,7 @@ constat_parse(HANDLE h, struct constat *s, const WCHAR **ptrp, long *lenp) } rest = 0; } - else { + else if ((rest = *lenp - len) < MAXSIZE_CONSOLE_WRITING) { continue; } *ptrp = ptr; @@ -7077,8 +7081,7 @@ rb_w32_write(int fd, const void *buf, size_t size) ret = 0; retry: - /* get rid of console writing bug */ - len = (_osfile(fd) & FDEV) ? min(32 * 1024, size) : size; + len = (_osfile(fd) & FDEV) ? min(MAXSIZE_CONSOLE_WRITING, size) : size; size -= len; retry2: |